玫瑰香葡萄作用:在VB中为什么不能运行这段程序,要如何修改才能运行呢?

来源:百度文库 编辑:中科新闻网 时间:2024/05/09 03:08:14
public class form1
inherits System.windows.Forms.Form
Private Sub Command1_click(ByVal sender As System.object, ByVal e As System.eventargs)
handles Command1.Click
dim con as new oledb.oledbconnection("provider=sqloledb.1;integrated
security=sspi;persist security info=false;initial catalog=northwind;data
source=.;use procedure for prepare=1;auto translate=true;packet
size=4096;workstation id=j;use encryption for data=false;tag with column collation
when possible=false")
con.open()
dim cmd as new oledb.oledbcommand("create database jk", con)
cmd.executenonquery()
con.close()
''建立数据库
End Sub
private sub Command2_click(byval sender as system.object, byval e as
system.eventargs) handles Command2.click
dim con2 as new oledb.oledbconnection("provider=sqloledb.1;integrated
security=sspi;persist security info=false;initial catalog=jk;data source=.;use
procedure for prepare=1;auto translate=true;packet size=4096;workstation id=j;use
encryption for data=false;tag with column collation when possible=false")
con2.open()
dim cmd as new oledb.oledbcommand("create table kk(id int identity(1,1) not
null constraint id primary key,name char(4) not null)", con2)
cmd.executenonquery()
dim cmd2 as new oledb.oledbcommand("create table pp(id int not null,ads
char(20) null)", con2)
cmd2.executenonquery()
con2.close()
''建立2个表
End Sub
end class

1/此程序为VB.net
2/oledb可能未引用