我目前正面临一个问题。我有一个名为" DESC1"在一个名为" Master"的表中。我试图根据这个方面的内容来检索价值......
I'm called.
// <note: 5-second wait is here>
End.
java.util.concurrent.CompletableFuture@<...>[Completed normally]
java.util.concurrent.CompletableFuture@<...>[Completed normally]
java.util.concurrent.CompletableFuture@<...>[Completed normally]
我试图在correctString1和correctString旁边的excel上显示
"Select DESC1 FROM Master WHERE '" & TextBox1.Text & "' "
希望你能帮助我。
答案 0 :(得分:1)
Dim sqlConnection1 As New SqlConnection("Your Connection String")
Dim cmd As New SqlCommand
Dim reader As SqlDataReader
cmd.CommandText = "Select DESC1 FROM Master WHERE '" & TextBox1.Text & "' "
cmd.CommandType = CommandType.Text
cmd.Connection = sqlConnection1
sqlConnection1.Open()
reader = cmd.ExecuteReader()
' Data is accessible through the DataReader object here.
If reader.HasRows Then
Do While reader.Read()
Console.WriteLine(reader.GetInt32(0) _
& vbTab & reader.GetString(1))
Loop
Else
Console.WriteLine("No rows found.")
End If
sqlConnection1.Close()
考虑第一列是NUMBER
类型,第二列是VARCHAR
<强> ==更新== 强>
connetionString = "Data Source=ServerName;Initial Catalog=DatabaseName;User ID=UserName;Password=Password"