Home > database >  In c # read Access data
In c # read Access data

Time:09-26

Just started learning database, and then to the c # read access database to meet the conditions of a data display in the label control, the following code
Connection1. The Open ();
String xuehao="123456";
String sql3="select the name from studentInfo where [studentnumber]=" + xuehao;
OleDbDataAdapter da=new OleDbDataAdapter (sql3, connection1);
The DataTable dt=new DataTable ();//the new table objects
Da. The Fill (dt, "student");//with filling table object
Label1. Text=ds. Tables [r]. "student" Rows [0]. The ToString (). The Trim ();
Has been an error

This is what reason, pursuing big coffee to give directions, thank you!!!!!
Xuehao the corresponding text types in the database is this type of essay,

CodePudding user response:

I don't know
Have to check the following returned the results
The second to get the first line of the first column expressions
Ds. Tables [r]. "student" Rows [0] [r]. "the name" the ToString ()
  • Related