Click here to Skip to main content
15,914,111 members
Home / Discussions / C#
   

C#

 
AnswerRe: Threading Pin
S. Senthil Kumar15-Dec-05 20:37
S. Senthil Kumar15-Dec-05 20:37 
GeneralRe: Threading Pin
Stephen McAllister15-Dec-05 22:24
Stephen McAllister15-Dec-05 22:24 
QuestionInteracting with Dallas IButton form C# Pin
Krrish15-Dec-05 19:49
Krrish15-Dec-05 19:49 
AnswerRe: Interacting with Dallas IButton form C# Pin
Heath Stewart15-Dec-05 21:21
protectorHeath Stewart15-Dec-05 21:21 
Questionwhy doesnt this xml load into an xmldoc ? Pin
g00fyman15-Dec-05 19:36
g00fyman15-Dec-05 19:36 
AnswerRe: why doesnt this xml load into an xmldoc ? Pin
S. Senthil Kumar15-Dec-05 20:41
S. Senthil Kumar15-Dec-05 20:41 
GeneralRe: why doesnt this xml load into an xmldoc ? Pin
g00fyman16-Dec-05 15:20
g00fyman16-Dec-05 15:20 
Questionnewbie in c# Pin
yaminilathatv15-Dec-05 19:36
yaminilathatv15-Dec-05 19:36 
Hi everyone,
I am newbie in C# and I have a doubt in retrieving the values from database based on search criteria. It is working well in vb.net but i am facing problem in C# i am writing the codes both in vb.net and c# please anyone help me where i am going wrong....

vb.net code:

connectdb()
cmd.commandtext="select * from Emp where sno="& val(textbox1.text)
da.selectcommand=cmd
da.fill(ds,"Emp")
for each dr in ds.tables("Emp").Rows
If val(textbox1.text)=dr.Item(0) then
textbox1.text=dr.item(0)
textbox2.text=dr.item(2)
textbox3.text=dr.item(2)
textbox4.text=dr.item(3)
end if
next
con.close()


C# code:

try
{
dbconnect();
Cmd.CommandText = " Select * from Emp where Empno=" + Convert.ToInt32(TextBox1.Text);
da.SelectCommand = Cmd;
da.Fill(ds, "Emp");
dt=ds.Tables["Emp"];
foreach ( DataTable table in ds.Tables )
{
foreach (DataRow dr in ds.Tables["Emp"].Rows) {
if (Convert.ToInt32(TextBox1.Text) = row["Empno"].ToString())
{ TextBox1.Text = row["Empno"].ToString;
TextBox2.Text = row["Name"].ToString;
TextBox3.Text = row["Dept"].ToString;
TextBox4.Text = row["Salary"].ToString;

}
}
}
catch (Exception ex)
{
Response.Redirect(ex.Message);
}
Con.Close();
}

the error in c# is that 'row' is not a member of data.
What is the equivalent code of dr.item in vb.net to c#
anyone please help me
thanks inadvance

AnswerRe: newbie in c# Pin
Vikram A Punathambekar15-Dec-05 21:49
Vikram A Punathambekar15-Dec-05 21:49 
GeneralRe: newbie in c# Pin
yaminilathatv15-Dec-05 22:23
yaminilathatv15-Dec-05 22:23 
AnswerRe: newbie in c# Pin
J4amieC15-Dec-05 21:49
J4amieC15-Dec-05 21:49 
GeneralRe: newbie in c# Pin
J4amieC15-Dec-05 21:51
J4amieC15-Dec-05 21:51 
GeneralRe: newbie in c# Pin
yaminilathatv15-Dec-05 22:27
yaminilathatv15-Dec-05 22:27 
GeneralRe: newbie in c# Pin
J4amieC16-Dec-05 0:25
J4amieC16-Dec-05 0:25 
GeneralRe: newbie in c# Pin
yaminilathatv16-Dec-05 21:55
yaminilathatv16-Dec-05 21:55 
QuestionSchema Pin
Mahi.Ragava15-Dec-05 18:00
Mahi.Ragava15-Dec-05 18:00 
QuestionCheckbox Arrays... Pin
flicktom15-Dec-05 17:48
flicktom15-Dec-05 17:48 
AnswerRe: Checkbox Arrays... Pin
flicktom15-Dec-05 18:26
flicktom15-Dec-05 18:26 
AnswerRe: Checkbox Arrays... Pin
J. Dunlap15-Dec-05 18:26
J. Dunlap15-Dec-05 18:26 
QuestionHit testing problem Pin
t800t815-Dec-05 15:44
t800t815-Dec-05 15:44 
AnswerRe: Hit testing problem Pin
Heath Stewart15-Dec-05 21:35
protectorHeath Stewart15-Dec-05 21:35 
GeneralRe: Hit testing problem Pin
t800t815-Dec-05 22:01
t800t815-Dec-05 22:01 
Question[URGENT] REGEX question Pin
Sam 200615-Dec-05 15:20
Sam 200615-Dec-05 15:20 
AnswerRe: [URGENT] REGEX question Pin
Christian Graus15-Dec-05 16:12
protectorChristian Graus15-Dec-05 16:12 
Questionopen an executable file on remote machine using WMI Pin
Erick Shuai15-Dec-05 15:12
Erick Shuai15-Dec-05 15:12 

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.