Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I use a SQL query and store the result into a datatable and now I want to write a specific cell data in to a string or char.

Below is the code I want to get the data from row[0] column[1]

da = new SqlDataAdapter("SELECT * FROM SeatsDetails WHERE ServiceNo='"+srno+"' AND Date='"+date+"'", con);
dt = new DataTable();
da.Fill(dt);
String t1 = (String) dt.Rows[0][1];
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
398 views
Welcome To Ask or Share your Answers For Others

1 Answer

I had got it using, Thanks fo the effort.

String t1 = dt.Rows[0][1].ToString();

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...