SQL 初级问题
应该是03编的软件,EXE同目录下有一REW.MDF 文件,经反编得程序中调用如下:
Imports Finisar.SQLite
.........
.........
Dim S As SqlClient.SqlConnection
S = New SqlClient.SqlConnection
S.ConnectionString= "DataSource=REW.MDF;New=False;Compress=
False;Synchronous=Off;UTF8Encoding=False "
Dim sa As SqlClient.SqlCommand
sa.CommandText = "create table ms(ms text, sm text) "
sa.ExecuteNonQuery()
现在我想用2005写个小程序对REW.MDF进行编辑,我把上面的代码放在05里出错,请给我个简单的代码,谢谢!
[解决办法]
这个是MS SQL的数据库,你安装MSSQL了吗?
如果装了改一下连接串等就行,如:
Dim S As SqlClient.SqlConnection
S = New SqlClient.SqlConnection
S.ConnectionString= "Data Source=localhost;Initial Catalog=NEW;User Id=sa;Password= "
S.Open()
Dim sa As SqlClient.SqlCommand
sa.connection=S
sa.CommandText = "create table ms(ms text, sm text) "
sa.ExecuteNonQuery()
[解决办法]
还要加上建立sa对象语句:
Dim sa As SqlClient.SqlCommand '这句是原来的
sa=new SqlClient.SqlCommand '这句是新增的
sa.connection=S '这句是原来的