ado.net如何用select into创建一个新的access 数据表?
Dim strcon As String
strCon = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source= " + Application.StartupPath + "\Config.mdb "
mycon = New Data.OleDb.OleDbConnection(strcon)
mycon.Open()
Mycom.Connection = mycon
Dim strSQL As String
strSQL = "select 11.* into [33] from 11 "
adpt = New OleDb.OleDbDataAdapter(strSQL, mycon)
adpt.Fill(MyDataSet, "table1 ")
vtable = MyDataSet.Tables( "table1 ")
mycon.Close()
DataGridView1.DataSource = vtable
执行这样的语句生成不了表33,也没有出错提示,请问以上哪些地方错了?请高手指点迷津!谢谢!
[解决办法]
Dim strcon As String
strCon="Provider=Microsoft.Jet.OLEDB.4.0;Data Source= " + _
Application.StartupPath + "\Config.mdb "
mycon = New Data.OleDb.OleDbConnection(strcon)
mycon.Open()
Dim strSQL As String="select * from 11 into [33]"
'你可能是需要一个oledbcommand对象!adapter不是干这个用的。
dim Cmm as oledbcommand =mycon.creatcommand()
Cmm.commandtext=strsql
cmm.excutenonquery()
这样就够了!