level 11
诚实的小人h
楼主
请各位大神看看为什么连库没反应。代码如下:
Public Class Form4
Dim DS As New DataSet
Dim XSTable As DataTable
Dim Da As New SqlClient.SqlDataAdapter
Public Sub refreshdata()
Da.Update(DS, "st")
XSTable.Clear()
Me.Button1_Click(Nothing, Nothing)
End Sub
Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
Me.Hide()
Form1.Show()
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Me.Hide()
Form6.Show()
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
Me.Hide()
Form7.Show()
End Sub
Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
Dim cn As New SqlClient.SqlConnection
Dim cmd As New SqlClient.SqlCommand
cn.ConnectionString = "server=IDEA-PC\MSSQLSERVER1;uid=hqp;pwd=325314;database=Train_Tickets"
cmd.Connection = cn
Dim builder As SqlClient.SqlCommandBuilder = New SqlClient.SqlCommandBuilder(Da)
cn.Open()
cmd.CommandText = "select * from st"
Da.SelectCommand = cmd
Da.Fill(DS, "st")
XSTable = DS.Tables("st")
cn.Close()
DataGridView1.DataSource = XSTable
End Sub
Private Sub DataGridView1_CellContentClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DataGridView1.CellContentClick
End Sub
End Class
2014年12月09日 12点12分
1
Public Class Form4
Dim DS As New DataSet
Dim XSTable As DataTable
Dim Da As New SqlClient.SqlDataAdapter
Public Sub refreshdata()
Da.Update(DS, "st")
XSTable.Clear()
Me.Button1_Click(Nothing, Nothing)
End Sub
Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
Me.Hide()
Form1.Show()
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Me.Hide()
Form6.Show()
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
Me.Hide()
Form7.Show()
End Sub
Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
Dim cn As New SqlClient.SqlConnection
Dim cmd As New SqlClient.SqlCommand
cn.ConnectionString = "server=IDEA-PC\MSSQLSERVER1;uid=hqp;pwd=325314;database=Train_Tickets"
cmd.Connection = cn
Dim builder As SqlClient.SqlCommandBuilder = New SqlClient.SqlCommandBuilder(Da)
cn.Open()
cmd.CommandText = "select * from st"
Da.SelectCommand = cmd
Da.Fill(DS, "st")
XSTable = DS.Tables("st")
cn.Close()
DataGridView1.DataSource = XSTable
End Sub
Private Sub DataGridView1_CellContentClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DataGridView1.CellContentClick
End Sub
End Class