Click here to Skip to main content
15,890,438 members
Home / Discussions / ASP.NET
   

ASP.NET

 
QuestionWebService with ASP.net ERROR Pin
kendo1730-Oct-07 5:42
kendo1730-Oct-07 5:42 
AnswerRe: WebService with ASP.net ERROR Pin
Paddy Boyd30-Oct-07 5:52
Paddy Boyd30-Oct-07 5:52 
Questionhow to unlock design mode in debugging Pin
Farhad Eft30-Oct-07 4:47
Farhad Eft30-Oct-07 4:47 
AnswerRe: how to unlock design mode in debugging Pin
pmarfleet30-Oct-07 5:57
pmarfleet30-Oct-07 5:57 
Questionhelp needed developing chat application ( with notification server) Pin
sarat12in30-Oct-07 4:43
sarat12in30-Oct-07 4:43 
AnswerRe: help needed developing chat application ( with notification server) Pin
Christian Graus30-Oct-07 11:09
protectorChristian Graus30-Oct-07 11:09 
QuestionParsing URL for subdomain only Pin
csinva30-Oct-07 4:39
csinva30-Oct-07 4:39 
QuestionProblem with DataReader............ Pin
Deepak Nigam30-Oct-07 3:30
Deepak Nigam30-Oct-07 3:30 
Rose | [Rose] Hello friends,

I am having some problem while accessing the required value from the datareader.
Below is the sample code that i have wriiten................

SqlConnection con=new SqlConnection("server=localhost;database=dept;uid=sa;pwd= ;");
SqlCommaned cmd=new SqlCommand();

Button1_Click(...)
{
cmd.CommandText="select fname from stu where sno=@sno";
cmd.Parameters.Add("@sno", TextBox1.Text.tostring();
cmd.connection=con;
con.open();
string str;
DataReader dr=cmd.ExecuteReader();
while(dr.Read())
{
str=dr.GetValue(0).ToString(); //Error: string str is not initialized
}
con.close();

}

But if i retrieve the value in a label then this code is working fine and i m getting the required valued in the label.

Tell me that how to resolve this problem.

I want to store the required valued directly in the local variable.

Plzzzzzzzzzzz help me




Deepak Nigam

AnswerRe: Problem with DataReader............ Pin
ToddHileHoffer30-Oct-07 3:33
ToddHileHoffer30-Oct-07 3:33 
AnswerRe: Problem with DataReader............ Pin
Herman<T>.Instance30-Oct-07 3:50
Herman<T>.Instance30-Oct-07 3:50 
AnswerRe: Problem with DataReader............ Pin
Abhijit Jana30-Oct-07 3:52
professionalAbhijit Jana30-Oct-07 3:52 
QuestionHow to access one Control from master page using Javascript Pin
VenkataRamana.Gali30-Oct-07 3:21
VenkataRamana.Gali30-Oct-07 3:21 
AnswerRe: How to access one Control from master page using Javascript Pin
ToddHileHoffer30-Oct-07 3:37
ToddHileHoffer30-Oct-07 3:37 
QuestionDocumnetation generator Pin
samerh30-Oct-07 3:07
samerh30-Oct-07 3:07 
AnswerRe: Documnetation generator Pin
Abhijit Jana30-Oct-07 3:14
professionalAbhijit Jana30-Oct-07 3:14 
GeneralRe: Documnetation generator Pin
samerh30-Oct-07 3:30
samerh30-Oct-07 3:30 
GeneralRe: Documnetation generator Pin
Abhijit Jana30-Oct-07 3:47
professionalAbhijit Jana30-Oct-07 3:47 
Questiondatagrid paging Pin
jai 12330-Oct-07 3:05
jai 12330-Oct-07 3:05 
AnswerRe: datagrid paging Pin
Abhijit Jana30-Oct-07 3:10
professionalAbhijit Jana30-Oct-07 3:10 
GeneralRe: datagrid paging Pin
jai 12330-Oct-07 3:17
jai 12330-Oct-07 3:17 
GeneralRe: datagrid paging Pin
MoustafaS30-Oct-07 14:49
MoustafaS30-Oct-07 14:49 
QuestionRead XmlNode value Pin
Imran Khan Pathan30-Oct-07 3:00
Imran Khan Pathan30-Oct-07 3:00 
AnswerRe: Read XmlNode value Pin
pmarfleet30-Oct-07 3:05
pmarfleet30-Oct-07 3:05 
Questionwhy dropdownlist box inside gridview dont work Pin
jefferyg2930-Oct-07 2:43
jefferyg2930-Oct-07 2:43 
AnswerRe: why dropdownlist box inside gridview dont work Pin
pmarfleet30-Oct-07 3:04
pmarfleet30-Oct-07 3:04 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.