Click here to Skip to main content
15,357,967 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
C#
Label l = default(Label);
		l = (Label)v.FindControl("Label1");
		l.Text = dt.Rows[ctr]["Serial"] +  ",";
		l = (Label)v.FindControl("Label2");
        dt.Rows[ctr]["question"] = l.Text;



I got error l.Text = dt.Rows[ctr]["Serial"] + ","; in this line there is no position at row.

C#
cmd.Parameters["@password"].Value = this.TextBox2.Text;

      SqlDataReader dr = null;

      dr = cmd.ExecuteReader();

      if (dr.HasRows)
      {



i got error in this line dr = cmd.ExecuteReader();


thanks for valuabel replay
Posted
Updated 18-Nov-11 9:07am
v3
Comments
Mehdi Gholam 18-Nov-11 15:07pm
   
EDIT -> fixed formatting

Your code seems incomplete or dont know what you want to do.

dt.Rows[ctr]["Serial"]


In this code what is ctr, Rows is jagged array where first boundary is columnName/Id and second boundary is RowID/RownNumber so your code should be like -

dt.Rows[ColumnName/ID][RowID] 


What are you trying to do with this code?

Regards
Rushi
   
Hi subbu,

i think your cmd object do not return the values.So you are getting this expcetion.
Just execute your querey in Sql Server Management Studio,you will find the mistake you committed.

I hope it helps you, any more problem,please send a query.
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900