Home > Software engineering > Bosses genuflect is begged!!!!! Help, vb programming to connect to the database, the adapter. Why th
Bosses genuflect is begged!!!!! Help, vb programming to connect to the database, the adapter. Why th
Time:09-17
The code below Private Sub Button1_Click (ByVal sender As System. Object, ByVal e the As System. EventArgs) Handles for. Click Dim myconn As SqlConnection=New SqlConnection (" database=online bookstore database; Data source=. Integrated security=true;" ) Dim mysql As String="select customercode As customer number, the name As the name, sex, sex As job As professional, birthday As date of birth, hometown As native, email As email, telephone As mobile phone Numbers, vipclass As customer rating, loyaltyclass As customer loyalty from customer where name like '%" & amp; TextBox1. Text & amp; "% ' "Dim myadapter As New SqlDataAdapter (mysql, myconn) Dim mydataset As New DataSet Myadapter. The Fill (mydataset, "customer") DataGridView1. The DataSource=mydataset. Tables (0) End Sub
CodePudding user response:
Tell what's wrong?????????????????????????????????????????????? Say first code can see out, your sqlconnection does not open; You want to fill in the dataset of the fill to a nonexistent datatable, I haven't tried, could find objects are available, and also could be created automatically, but itself is sqldataadapter can fill to a datatable, if there are no special requirements, the datatable more convenient than the dataset,
Dim Datatable1 As New DataTable Myadapter. The Fill (Datatable1) DataGridView1. The DataSource=Datatable1