Home > Net >  Vs2012 development language vb, data binding the GridView, run error. This code should be how to wri
Vs2012 development language vb, data binding the GridView, run error. This code should be how to wri

Time:11-25

Platform: vs2012
Development language: vb

Protected Sub Buton1_Click (sender As Object, As EventArgs e) Handles for. Click
Dim the rs AS the ADODB library you
Rs=New ADODB. You
Rs. The ActiveConnection="Provider=SQLOLEDB. 1; Password=132; Persist Security Info=True; User ID=sa; Initial Catalog=db_news; The Data Source=WIN - 3 l70iqhfnql
"Rs. CursorLocation=ADODB. CursorLocationEnum. AdUseClient
Rs. The CursorType=ADODB. CursorTypeEnum. AdOpenStatic
Rs. The Source="select userid, UserName from td_user order by id"
Rs. The Open ()
GridView1.
the DataSource=rs


CodePudding user response:

Good less people use ADO

CodePudding user response:

Rs. The ActiveConnection should be a Connection object, not the string , the other the GridView can bind you? Let's use the DataSet or the DataTable

CodePudding user response:

The error information is insufficient, can't screen what reason!
  • Related