myDataAdapter.fill行遇到一些问题,得到错误“From子句中的语法错误”看了解其他解决方案,没有一个有效,大多数似乎是关于保留字 - 所有想法,帮助!
'retrieve the connection string from the ConnectionString Key in Web.Config
'string connectionString = System.Configuration.ConfigurationSettings.AppSettings["ConnectionString"];
Dim connectionString As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=|DataDirectory|\Woof.mdb"
Dim myDataSet As New System.Data.DataSet("Email")
'create a new OleDB connection
Dim conn As New System.Data.OleDb.OleDbConnection(connectionString)
'pass the Select statement and connection information to the initializxation constructor for the OleDBDataAdapter
Dim myDataAdapter As New System.Data.OleDb.OleDbDataAdapter("SELECT Email FROM Email-list", conn)
'Fill the dataset and table with the data retrieved by the select command
myDataAdapter.Fill(myDataSet, "Email")
Dim str As String = myDataSet.ToString
Label3.Text = str
答案 0 :(得分:1)
使用查询
Dim myDataAdapter As New System.Data.OleDb.OleDbDataAdapter("SELECT Email FROM [Email-list]", conn)