标题:[求助]创建一个新表
只看楼主
xuyanfeng66
Rank: 1
等 级:新手上路
帖 子:9
专家分:0
注 册:2007-1-20
 问题点数:0 回复次数:4 
[求助]创建一个新表
  • 在ACCESS中创建一个新表,应该怎么做啊,表的结构为MIT(double),Height(double),Area(double)
搜索更多相关主题的帖子: double 
2007-01-22 18:00
xuyanfeng66
Rank: 1
等 级:新手上路
帖 子:9
专家分:0
注 册:2007-1-20
得分:0 

Dim SourceTableName As String = Yuanbiao.Text
Dim MyTableName As String = Xinbiao.Text

'创建新表
Dim MySql As String = "CREATE TABLE " + MyTableName + " (MyMt integer,Area double,Height double,MK INT) "

Dim myconn As New System.Data.OleDb.OleDbConnection
Dim strcnn As String
strcnn = "Jet OLEDB:Global Partial Bulk Ops=2;Jet OLEDB:Registry Path=;Jet OLEDB:Database L" & _
"ocking Mode=1;Data Source=""newdata.mdb"";Jet OLEDB:Engine Type=5;Provider=""Microsoft.J" & _
"et.OLEDB.4.0"";Jet OLEDB:System database=;Jet OLEDB:SFP=False;persist security in" & _
"fo=False;Extended Properties=;Mode=Share Deny None;Jet OLEDB:Encrypt Database=Fa" & _
"lse;Jet OLEDB:Create System Database=False;Jet OLEDB:Don't Copy Locale on Compac" & _
"t=False;Jet OLEDB:Compact Without Replica Repair=False;User ID=Admin;Jet OLEDB:G" & _
"lobal Bulk Transactions=1"
myconn.ConnectionString = strcnn
myconn.Open()
Dim mycommand As New OleDb.OleDbCommand(MySql, myconn)
mycommand.Connection.ConnectionString = myconn.ConnectionString
mycommand.CommandText = MySql
mycommand.Connection = myconn
mycommand.ExecuteNonQuery()
myconn.Close()
总是出错,创建不了呢,在这句mycommand.Connection.ConnectionString = myconn.ConnectionString有错误

2007-01-22 18:03
bygg
Rank: 16Rank: 16Rank: 16Rank: 16
来 自:乖乖的心中
等 级:版主
威 望:241
帖 子:13555
专家分:3076
注 册:2006-10-23
得分:0 
mycommand.Connection.ConnectionString = myconn.ConnectionString

这句有什么用???

飘过~~
2007-01-23 10:41
Kendy123456
Rank: 10Rank: 10Rank: 10
等 级:贵宾
威 望:62
帖 子:2720
专家分:0
注 册:2007-1-3
得分:0 

去掉这句就可以了!


2007-01-23 14:07
wangfuli
Rank: 4
等 级:贵宾
威 望:12
帖 子:206
专家分:10
注 册:2005-11-11
得分:0 
Dim myconn As New System.Data.OleDb.OleDbConnection("")'connetionstring
myconn.Open()
Dim mycommand As New OleDb.OleDbCommand(MySql, myconn)
mycommand.ExecuteNonQuery
myconn.close

2007-01-23 17:08



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-117524-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.048014 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved