本文整理汇总了VB.NET中System.Data.SqlClient.SqlCommand.SqlCommand构造函数的典型用法代码示例。如果您正苦于以下问题:VB.NET SqlCommand构造函数的具体用法?VB.NET SqlCommand怎么用?VB.NET SqlCommand使用的例子?那么恭喜您, 这里精选的构造函数代码示例或许可以为您提供帮助。您也可以进一步了解该构造函数所在类System.Data.SqlClient.SqlCommand
的用法示例。
在下文中一共展示了SqlCommand构造函数的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的VB.NET代码示例。
示例1: CreateSqlCommand
Public Sub CreateSqlCommand()
Dim command As New SqlCommand()
command.CommandTimeout = 15
command.CommandType = CommandType.Text
End Sub
示例2: CreateCommand
Public Sub CreateCommand()
Dim queryString As String = "SELECT * FROM Categories ORDER BY CategoryID"
Dim command As New SqlCommand(queryString)
command.CommandTimeout = 15
command.CommandType = CommandType.Text
End Sub
示例3: CreateCommand
Public Sub CreateCommand(ByVal queryString As String, _
ByVal connectionString As String)
Using connection As New SqlConnection(connectionString)
Dim command As New SqlCommand(queryString, connection)
connection.Open()
Dim reader As SqlDataReader = command.ExecuteReader()
While reader.Read()
Console.WriteLine(String.Format("{0}, {1}", _
reader(0), reader(1)))
End While
End Using
End Sub