Visual Studio:无法解析连接标识符

时间:2013-11-18 15:39:06

标签: sql vb.net visual-studio-2010

我能够编译来运行代码,但是当表单输出并输入要搜索的值时,它会给出标题中指出的错误。这是代码:

Public Class Form1

    Private Sub Search_Click(sender As Object, e As EventArgs) Handles Search.Click
        Dim myConn As New OleDb.OleDbConnection
        Dim myString As String
        Dim myArg As String
        Dim mysql As String
        ' Connect to dataset

        myString = "Provider=msdaora;data source=orcl;User Id=XXXXXX;Password=XXXXX"
        myConn.ConnectionString = myString
        ' Get the argument
        myArg = TextBox1.Text
        mysql = "select * from Orders where lastname like '%" + myArg + "%'"
        Try
            myConn.Open()
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try
        'Create data adapter
        Dim myDataadapter As New OleDb.OleDbDataAdapter(mysql, myConn)

        ' Create a dataset
        Dim myDs As New DataSet

        ' Fill the dataset
        myDataadapter.Fill(myDs, "customer")
        ' Display ADO data.....
        DataGridView1.DataSource = myDs
        DataGridView1.DataMember = "customer"
    End Sub
End Class

0 个答案:

没有答案