VB.NET连接MSSQL2005数据库,并插入,删除,查询数据代码?
请详细一些谢谢~
6 个解决方案
#1
没用过
难道不是用sql语言那进行?
难道不是用sql语言那进行?
#2
50分想拿这么多代码,兄台!有点贪心喔!
#3
Public Sub Update(ByRef Data As DataTable)
Dim da As New SqlDataAdapter
da.InsertCommand = BuildInsertCommand(Data)
da.UpdateCommand = BuildUpdateCommand(Data)
da.Update(Data)
CloseConnection()
End Sub
Private Function BuildUpdateCommand(ByRef Data As DataTable) As SqlCommand
Dim NewCmd As New SqlCommand
NewCmd.Connection = Connection
Dim SetString As String
Dim Identity As String
For Each Col As DataColumn In Data.Columns
If Col.AutoIncrement Then
Identity = Col.ColumnName & " = @" & Col.ColumnName
Else
If Not (SetString = String.Empty) Then
SetString &= ", "
End If
SetString &= Col.ColumnName & " = @" & Col.ColumnName
End If
Dim Param As New SqlParameter
Param.ParameterName = "@" & Col.ColumnName
Param.SourceColumn = Col.ColumnName
NewCmd.Parameters.Add(Param)
Next Col
Dim CmdText As String = "UPDATE " & Data.TableName & " SET " & SetString & " WHERE " & Identity
NewCmd.CommandText = CmdText
Return NewCmd
End Function
Private Function BuildInsertCommand(ByRef Data As DataTable) As SqlCommand
Dim NewCmd As New SqlCommand
NewCmd.Connection = Connection
Dim Fields As String
Dim Values As String
Dim Identity As String
For Each Col As DataColumn In Data.Columns
If Col.AutoIncrement Then
Identity = "SELECT @@SCOPE_IDENTITY AS " & Col.ColumnName
Else
If Not (Fields = String.Empty) Then
Fields &= ", "
End If
Fields &= Col.ColumnName
If Not (Values = String.Empty) Then
Values &= ", "
End If
Values &= "@" & Col.ColumnName
Dim Param As New SqlParameter
Param.ParameterName = "@" & Col.ColumnName
Param.SourceColumn = Col.ColumnName
NewCmd.Parameters.Add(Param)
End If
Next Col
Dim CmdText As String = "INSERT INTO " & Data.TableName & "(" & Fields & ") VALUES(" & Values & ")"
If Not (Identity Is Nothing) Then
CmdText &= "; " & Identity
End If
NewCmd.CommandText = CmdText
Return NewCmd
End Function
Dim da As New SqlDataAdapter
da.InsertCommand = BuildInsertCommand(Data)
da.UpdateCommand = BuildUpdateCommand(Data)
da.Update(Data)
CloseConnection()
End Sub
Private Function BuildUpdateCommand(ByRef Data As DataTable) As SqlCommand
Dim NewCmd As New SqlCommand
NewCmd.Connection = Connection
Dim SetString As String
Dim Identity As String
For Each Col As DataColumn In Data.Columns
If Col.AutoIncrement Then
Identity = Col.ColumnName & " = @" & Col.ColumnName
Else
If Not (SetString = String.Empty) Then
SetString &= ", "
End If
SetString &= Col.ColumnName & " = @" & Col.ColumnName
End If
Dim Param As New SqlParameter
Param.ParameterName = "@" & Col.ColumnName
Param.SourceColumn = Col.ColumnName
NewCmd.Parameters.Add(Param)
Next Col
Dim CmdText As String = "UPDATE " & Data.TableName & " SET " & SetString & " WHERE " & Identity
NewCmd.CommandText = CmdText
Return NewCmd
End Function
Private Function BuildInsertCommand(ByRef Data As DataTable) As SqlCommand
Dim NewCmd As New SqlCommand
NewCmd.Connection = Connection
Dim Fields As String
Dim Values As String
Dim Identity As String
For Each Col As DataColumn In Data.Columns
If Col.AutoIncrement Then
Identity = "SELECT @@SCOPE_IDENTITY AS " & Col.ColumnName
Else
If Not (Fields = String.Empty) Then
Fields &= ", "
End If
Fields &= Col.ColumnName
If Not (Values = String.Empty) Then
Values &= ", "
End If
Values &= "@" & Col.ColumnName
Dim Param As New SqlParameter
Param.ParameterName = "@" & Col.ColumnName
Param.SourceColumn = Col.ColumnName
NewCmd.Parameters.Add(Param)
End If
Next Col
Dim CmdText As String = "INSERT INTO " & Data.TableName & "(" & Fields & ") VALUES(" & Values & ")"
If Not (Identity Is Nothing) Then
CmdText &= "; " & Identity
End If
NewCmd.CommandText = CmdText
Return NewCmd
End Function
#4
我有个笨方法~不知道2005用不用得到2003有的
新键一个数据库向导窗体,就有你想要的功能了~
查询数据这个好象没有~
新键一个数据库向导窗体,就有你想要的功能了~
查询数据这个好象没有~
#5
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
''读取数据
'Dim myConnection As New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;User ID=Admin;Data Source=C:\Documents and Settings\Administrator\桌面\共享文件(于广建)\dbterminal.mdb")
'Dim mySelectQuery As String = "select * from tab_DATA_SJ"
'Dim mycommand As New OleDbCommand(mySelectQuery, myConnection)
'myConnection.Open()
'Dim myReader As OleDbDataReader
'myReader = mycommand.ExecuteReader()
'myReader.Read()
'Label1.Text = CStr(myReader.GetInt32(0)) + "," + myReader.GetString(1)
'myReader.Read()
'Label2.Text = CStr(myReader.GetInt32(0)) + "," + myReader.GetString(1)
'myReader.Read()
'Label3.Text = CStr(myReader.GetInt32(0)) + "," + myReader.GetString(1)
'myReader.Close()
'myConnection.Close()
'添加数据
'Dim mySelectQuery As String = "INSERT INTO tab_DATA_SJ (id,LogicChannelNo,PhysicsPort,sNumber,SjNumber,ReceiveText,ReceiveDateTime,OldSendNameForShort,TeleNo,Checked) VALUES ('111','00','01','00200510120001','001','GNSJ 0001 AQH 1010 15.20','2005-10-12 15:20:13','AQH','1010','1')"
'Dim myConnection As New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;User ID=Admin;Data Source=C:\Documents and Settings\Administrator\桌面\共享文件(于广建)\dbterminal.mdb")
'Dim mycommand As New OleDbCommand(mySelectQuery, myConnection)
'myConnection.Open()
'mycommand.ExecuteNonQuery()
'myConnection.Close()
''更新数据
'Dim mySelectQuery As String = "UPDATE tab_DATA_SJ set PhysicsPort=11 WHERE ID=111"
'Dim myConnection As New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;User ID=Admin;Data Source=C:\Documents and Settings\Administrator\桌面\共享文件(于广建)\dbterminal.mdb")
'Dim mycommand As New OleDbCommand(mySelectQuery, myConnection)
'myConnection.Open()
'mycommand.ExecuteNonQuery()
'myConnection.Close()
'删除数据
'Dim mySelectQuery As String = "delete from tab_DATA_SJ where id=560"
'Dim myConnection As New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;User ID=Admin;Data Source=C:\Documents and Settings\Administrator\桌面\共享文件(于广建)\dbterminal.mdb")
'Dim mycommand As New OleDbCommand(mySelectQuery, myConnection)
'myConnection.Open()
'mycommand.ExecuteNonQuery()
'myConnection.Close()
' 数据查找()
Dim myReader As OleDbDataReader
Dim mySelectQuery As String
Dim myreader4 As OleDbDataReader
Dim myConnection As New OleDbConnection
mySelectQuery = "select SjNumber from tab_DATA_SJ where val(SjNumber)>0001 "
myConnection.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;User ID=Admin;Data Source=C:\Documents and Settings\Administrator\桌面\共享文件(于广建)\dbterminal.mdb"
Dim mycommand As New OleDb.OleDbCommand
With mycommand
.Connection = myConnection
.CommandText = mySelectQuery
.CommandTimeout = 4
End With
myConnection.Open()
myReader = mycommand.ExecuteReader()
Try
While myReader.Read()
TextBox1.Text = TextBox1.Text & CStr(myReader.GetString(0)) & ","
End While
Catch ex As Exception
myReader.Close()
myConnection.Close()
End Try
End Sub
''读取数据
'Dim myConnection As New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;User ID=Admin;Data Source=C:\Documents and Settings\Administrator\桌面\共享文件(于广建)\dbterminal.mdb")
'Dim mySelectQuery As String = "select * from tab_DATA_SJ"
'Dim mycommand As New OleDbCommand(mySelectQuery, myConnection)
'myConnection.Open()
'Dim myReader As OleDbDataReader
'myReader = mycommand.ExecuteReader()
'myReader.Read()
'Label1.Text = CStr(myReader.GetInt32(0)) + "," + myReader.GetString(1)
'myReader.Read()
'Label2.Text = CStr(myReader.GetInt32(0)) + "," + myReader.GetString(1)
'myReader.Read()
'Label3.Text = CStr(myReader.GetInt32(0)) + "," + myReader.GetString(1)
'myReader.Close()
'myConnection.Close()
'添加数据
'Dim mySelectQuery As String = "INSERT INTO tab_DATA_SJ (id,LogicChannelNo,PhysicsPort,sNumber,SjNumber,ReceiveText,ReceiveDateTime,OldSendNameForShort,TeleNo,Checked) VALUES ('111','00','01','00200510120001','001','GNSJ 0001 AQH 1010 15.20','2005-10-12 15:20:13','AQH','1010','1')"
'Dim myConnection As New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;User ID=Admin;Data Source=C:\Documents and Settings\Administrator\桌面\共享文件(于广建)\dbterminal.mdb")
'Dim mycommand As New OleDbCommand(mySelectQuery, myConnection)
'myConnection.Open()
'mycommand.ExecuteNonQuery()
'myConnection.Close()
''更新数据
'Dim mySelectQuery As String = "UPDATE tab_DATA_SJ set PhysicsPort=11 WHERE ID=111"
'Dim myConnection As New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;User ID=Admin;Data Source=C:\Documents and Settings\Administrator\桌面\共享文件(于广建)\dbterminal.mdb")
'Dim mycommand As New OleDbCommand(mySelectQuery, myConnection)
'myConnection.Open()
'mycommand.ExecuteNonQuery()
'myConnection.Close()
'删除数据
'Dim mySelectQuery As String = "delete from tab_DATA_SJ where id=560"
'Dim myConnection As New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;User ID=Admin;Data Source=C:\Documents and Settings\Administrator\桌面\共享文件(于广建)\dbterminal.mdb")
'Dim mycommand As New OleDbCommand(mySelectQuery, myConnection)
'myConnection.Open()
'mycommand.ExecuteNonQuery()
'myConnection.Close()
' 数据查找()
Dim myReader As OleDbDataReader
Dim mySelectQuery As String
Dim myreader4 As OleDbDataReader
Dim myConnection As New OleDbConnection
mySelectQuery = "select SjNumber from tab_DATA_SJ where val(SjNumber)>0001 "
myConnection.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;User ID=Admin;Data Source=C:\Documents and Settings\Administrator\桌面\共享文件(于广建)\dbterminal.mdb"
Dim mycommand As New OleDb.OleDbCommand
With mycommand
.Connection = myConnection
.CommandText = mySelectQuery
.CommandTimeout = 4
End With
myConnection.Open()
myReader = mycommand.ExecuteReader()
Try
While myReader.Read()
TextBox1.Text = TextBox1.Text & CStr(myReader.GetString(0)) & ","
End While
Catch ex As Exception
myReader.Close()
myConnection.Close()
End Try
End Sub
#6
和2003里没什么不同啊!只不过现在对于简单的查询等操作可以不用自己写代码而已!
比较方便!
我现在主要是用2005里的DataSource控件来生成Sql语句 感觉很好用!
比较方便!
我现在主要是用2005里的DataSource控件来生成Sql语句 感觉很好用!
#1
没用过
难道不是用sql语言那进行?
难道不是用sql语言那进行?
#2
50分想拿这么多代码,兄台!有点贪心喔!
#3
Public Sub Update(ByRef Data As DataTable)
Dim da As New SqlDataAdapter
da.InsertCommand = BuildInsertCommand(Data)
da.UpdateCommand = BuildUpdateCommand(Data)
da.Update(Data)
CloseConnection()
End Sub
Private Function BuildUpdateCommand(ByRef Data As DataTable) As SqlCommand
Dim NewCmd As New SqlCommand
NewCmd.Connection = Connection
Dim SetString As String
Dim Identity As String
For Each Col As DataColumn In Data.Columns
If Col.AutoIncrement Then
Identity = Col.ColumnName & " = @" & Col.ColumnName
Else
If Not (SetString = String.Empty) Then
SetString &= ", "
End If
SetString &= Col.ColumnName & " = @" & Col.ColumnName
End If
Dim Param As New SqlParameter
Param.ParameterName = "@" & Col.ColumnName
Param.SourceColumn = Col.ColumnName
NewCmd.Parameters.Add(Param)
Next Col
Dim CmdText As String = "UPDATE " & Data.TableName & " SET " & SetString & " WHERE " & Identity
NewCmd.CommandText = CmdText
Return NewCmd
End Function
Private Function BuildInsertCommand(ByRef Data As DataTable) As SqlCommand
Dim NewCmd As New SqlCommand
NewCmd.Connection = Connection
Dim Fields As String
Dim Values As String
Dim Identity As String
For Each Col As DataColumn In Data.Columns
If Col.AutoIncrement Then
Identity = "SELECT @@SCOPE_IDENTITY AS " & Col.ColumnName
Else
If Not (Fields = String.Empty) Then
Fields &= ", "
End If
Fields &= Col.ColumnName
If Not (Values = String.Empty) Then
Values &= ", "
End If
Values &= "@" & Col.ColumnName
Dim Param As New SqlParameter
Param.ParameterName = "@" & Col.ColumnName
Param.SourceColumn = Col.ColumnName
NewCmd.Parameters.Add(Param)
End If
Next Col
Dim CmdText As String = "INSERT INTO " & Data.TableName & "(" & Fields & ") VALUES(" & Values & ")"
If Not (Identity Is Nothing) Then
CmdText &= "; " & Identity
End If
NewCmd.CommandText = CmdText
Return NewCmd
End Function
Dim da As New SqlDataAdapter
da.InsertCommand = BuildInsertCommand(Data)
da.UpdateCommand = BuildUpdateCommand(Data)
da.Update(Data)
CloseConnection()
End Sub
Private Function BuildUpdateCommand(ByRef Data As DataTable) As SqlCommand
Dim NewCmd As New SqlCommand
NewCmd.Connection = Connection
Dim SetString As String
Dim Identity As String
For Each Col As DataColumn In Data.Columns
If Col.AutoIncrement Then
Identity = Col.ColumnName & " = @" & Col.ColumnName
Else
If Not (SetString = String.Empty) Then
SetString &= ", "
End If
SetString &= Col.ColumnName & " = @" & Col.ColumnName
End If
Dim Param As New SqlParameter
Param.ParameterName = "@" & Col.ColumnName
Param.SourceColumn = Col.ColumnName
NewCmd.Parameters.Add(Param)
Next Col
Dim CmdText As String = "UPDATE " & Data.TableName & " SET " & SetString & " WHERE " & Identity
NewCmd.CommandText = CmdText
Return NewCmd
End Function
Private Function BuildInsertCommand(ByRef Data As DataTable) As SqlCommand
Dim NewCmd As New SqlCommand
NewCmd.Connection = Connection
Dim Fields As String
Dim Values As String
Dim Identity As String
For Each Col As DataColumn In Data.Columns
If Col.AutoIncrement Then
Identity = "SELECT @@SCOPE_IDENTITY AS " & Col.ColumnName
Else
If Not (Fields = String.Empty) Then
Fields &= ", "
End If
Fields &= Col.ColumnName
If Not (Values = String.Empty) Then
Values &= ", "
End If
Values &= "@" & Col.ColumnName
Dim Param As New SqlParameter
Param.ParameterName = "@" & Col.ColumnName
Param.SourceColumn = Col.ColumnName
NewCmd.Parameters.Add(Param)
End If
Next Col
Dim CmdText As String = "INSERT INTO " & Data.TableName & "(" & Fields & ") VALUES(" & Values & ")"
If Not (Identity Is Nothing) Then
CmdText &= "; " & Identity
End If
NewCmd.CommandText = CmdText
Return NewCmd
End Function
#4
我有个笨方法~不知道2005用不用得到2003有的
新键一个数据库向导窗体,就有你想要的功能了~
查询数据这个好象没有~
新键一个数据库向导窗体,就有你想要的功能了~
查询数据这个好象没有~
#5
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
''读取数据
'Dim myConnection As New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;User ID=Admin;Data Source=C:\Documents and Settings\Administrator\桌面\共享文件(于广建)\dbterminal.mdb")
'Dim mySelectQuery As String = "select * from tab_DATA_SJ"
'Dim mycommand As New OleDbCommand(mySelectQuery, myConnection)
'myConnection.Open()
'Dim myReader As OleDbDataReader
'myReader = mycommand.ExecuteReader()
'myReader.Read()
'Label1.Text = CStr(myReader.GetInt32(0)) + "," + myReader.GetString(1)
'myReader.Read()
'Label2.Text = CStr(myReader.GetInt32(0)) + "," + myReader.GetString(1)
'myReader.Read()
'Label3.Text = CStr(myReader.GetInt32(0)) + "," + myReader.GetString(1)
'myReader.Close()
'myConnection.Close()
'添加数据
'Dim mySelectQuery As String = "INSERT INTO tab_DATA_SJ (id,LogicChannelNo,PhysicsPort,sNumber,SjNumber,ReceiveText,ReceiveDateTime,OldSendNameForShort,TeleNo,Checked) VALUES ('111','00','01','00200510120001','001','GNSJ 0001 AQH 1010 15.20','2005-10-12 15:20:13','AQH','1010','1')"
'Dim myConnection As New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;User ID=Admin;Data Source=C:\Documents and Settings\Administrator\桌面\共享文件(于广建)\dbterminal.mdb")
'Dim mycommand As New OleDbCommand(mySelectQuery, myConnection)
'myConnection.Open()
'mycommand.ExecuteNonQuery()
'myConnection.Close()
''更新数据
'Dim mySelectQuery As String = "UPDATE tab_DATA_SJ set PhysicsPort=11 WHERE ID=111"
'Dim myConnection As New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;User ID=Admin;Data Source=C:\Documents and Settings\Administrator\桌面\共享文件(于广建)\dbterminal.mdb")
'Dim mycommand As New OleDbCommand(mySelectQuery, myConnection)
'myConnection.Open()
'mycommand.ExecuteNonQuery()
'myConnection.Close()
'删除数据
'Dim mySelectQuery As String = "delete from tab_DATA_SJ where id=560"
'Dim myConnection As New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;User ID=Admin;Data Source=C:\Documents and Settings\Administrator\桌面\共享文件(于广建)\dbterminal.mdb")
'Dim mycommand As New OleDbCommand(mySelectQuery, myConnection)
'myConnection.Open()
'mycommand.ExecuteNonQuery()
'myConnection.Close()
' 数据查找()
Dim myReader As OleDbDataReader
Dim mySelectQuery As String
Dim myreader4 As OleDbDataReader
Dim myConnection As New OleDbConnection
mySelectQuery = "select SjNumber from tab_DATA_SJ where val(SjNumber)>0001 "
myConnection.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;User ID=Admin;Data Source=C:\Documents and Settings\Administrator\桌面\共享文件(于广建)\dbterminal.mdb"
Dim mycommand As New OleDb.OleDbCommand
With mycommand
.Connection = myConnection
.CommandText = mySelectQuery
.CommandTimeout = 4
End With
myConnection.Open()
myReader = mycommand.ExecuteReader()
Try
While myReader.Read()
TextBox1.Text = TextBox1.Text & CStr(myReader.GetString(0)) & ","
End While
Catch ex As Exception
myReader.Close()
myConnection.Close()
End Try
End Sub
''读取数据
'Dim myConnection As New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;User ID=Admin;Data Source=C:\Documents and Settings\Administrator\桌面\共享文件(于广建)\dbterminal.mdb")
'Dim mySelectQuery As String = "select * from tab_DATA_SJ"
'Dim mycommand As New OleDbCommand(mySelectQuery, myConnection)
'myConnection.Open()
'Dim myReader As OleDbDataReader
'myReader = mycommand.ExecuteReader()
'myReader.Read()
'Label1.Text = CStr(myReader.GetInt32(0)) + "," + myReader.GetString(1)
'myReader.Read()
'Label2.Text = CStr(myReader.GetInt32(0)) + "," + myReader.GetString(1)
'myReader.Read()
'Label3.Text = CStr(myReader.GetInt32(0)) + "," + myReader.GetString(1)
'myReader.Close()
'myConnection.Close()
'添加数据
'Dim mySelectQuery As String = "INSERT INTO tab_DATA_SJ (id,LogicChannelNo,PhysicsPort,sNumber,SjNumber,ReceiveText,ReceiveDateTime,OldSendNameForShort,TeleNo,Checked) VALUES ('111','00','01','00200510120001','001','GNSJ 0001 AQH 1010 15.20','2005-10-12 15:20:13','AQH','1010','1')"
'Dim myConnection As New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;User ID=Admin;Data Source=C:\Documents and Settings\Administrator\桌面\共享文件(于广建)\dbterminal.mdb")
'Dim mycommand As New OleDbCommand(mySelectQuery, myConnection)
'myConnection.Open()
'mycommand.ExecuteNonQuery()
'myConnection.Close()
''更新数据
'Dim mySelectQuery As String = "UPDATE tab_DATA_SJ set PhysicsPort=11 WHERE ID=111"
'Dim myConnection As New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;User ID=Admin;Data Source=C:\Documents and Settings\Administrator\桌面\共享文件(于广建)\dbterminal.mdb")
'Dim mycommand As New OleDbCommand(mySelectQuery, myConnection)
'myConnection.Open()
'mycommand.ExecuteNonQuery()
'myConnection.Close()
'删除数据
'Dim mySelectQuery As String = "delete from tab_DATA_SJ where id=560"
'Dim myConnection As New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;User ID=Admin;Data Source=C:\Documents and Settings\Administrator\桌面\共享文件(于广建)\dbterminal.mdb")
'Dim mycommand As New OleDbCommand(mySelectQuery, myConnection)
'myConnection.Open()
'mycommand.ExecuteNonQuery()
'myConnection.Close()
' 数据查找()
Dim myReader As OleDbDataReader
Dim mySelectQuery As String
Dim myreader4 As OleDbDataReader
Dim myConnection As New OleDbConnection
mySelectQuery = "select SjNumber from tab_DATA_SJ where val(SjNumber)>0001 "
myConnection.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;User ID=Admin;Data Source=C:\Documents and Settings\Administrator\桌面\共享文件(于广建)\dbterminal.mdb"
Dim mycommand As New OleDb.OleDbCommand
With mycommand
.Connection = myConnection
.CommandText = mySelectQuery
.CommandTimeout = 4
End With
myConnection.Open()
myReader = mycommand.ExecuteReader()
Try
While myReader.Read()
TextBox1.Text = TextBox1.Text & CStr(myReader.GetString(0)) & ","
End While
Catch ex As Exception
myReader.Close()
myConnection.Close()
End Try
End Sub
#6
和2003里没什么不同啊!只不过现在对于简单的查询等操作可以不用自己写代码而已!
比较方便!
我现在主要是用2005里的DataSource控件来生成Sql语句 感觉很好用!
比较方便!
我现在主要是用2005里的DataSource控件来生成Sql语句 感觉很好用!