扫一扫
分享文章到微信
扫一扫
关注官方公众号
至顶头条
在本页阅读全文(共19页)
Public Class Form1 Inherits System.Windows.Forms.Form Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.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 Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.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 Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.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 com As New OleDb.OleDbCommand("alter table pp add primary key (id)", con2) com.ExecuteNonQuery() con2.Close() '建立约束 End Sub Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.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 com As New OleDb.OleDbCommand("create proc procname as select * from kk", con2) com.ExecuteNonQuery() con2.Close() '建立存储过程 End Sub Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.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") Dim com As New OleDb.OleDbCommand("procname", con2) Dim da As New OleDb.OleDbDataAdapter() da.SelectCommand = com Dim ds As New DataSet() da.Fill(ds) DataGrid1.DataSource = ds '显示数据 End Sub End Class |
如果您非常迫切的想了解IT领域最新产品与技术信息,那么订阅至顶网技术邮件将是您的最佳途径之一。
现场直击|2021世界人工智能大会
直击5G创新地带,就在2021MWC上海
5G已至 转型当时——服务提供商如何把握转型的绝佳时机
寻找自己的Flag
华为开发者大会2020(Cloud)- 科技行者