程序只是记录而已,还没有完成。
请不要模仿。
importsSystem.Data importsSystem.Data.oleDb PublicClassForm1 DimConnStrAsString=String.Format("ProvIDer=Microsoft.Jet.olEDB.4.0;DataSource={0};UserID=admin;Password={1};","D:\product.MDB","") DimconnAsoleDb.oleDbConnection DimcmdAsoleDb.oleDbCommand DimsqlAsString PrivateSubForm1_Load(ByValsenderAsSystem.Object,ByValeAsSystem.EventArgs)HandlesMyBase.Load 'cmd=NewoleDbCommand(sql,conn) 'cmd.ExecuteNonquery() conn=NewoleDb.oleDbConnection(ConnStr) EndSub PrivateSubbutton1_Click(ByValsenderAsSystem.Object,ByValeAsSystem.EventArgs)Handlesbutton1.Click DimdtAsDatatable DimtblAsDatatable Dimtbl2AsDatatable conn.open() 'tbl=conn.GetSchema()=数据库的所有架构信息。 '获取用户表 tbl=conn.GetSchema("tables",NewString(){nothing,nothing,"table"}) 'tbl=conn.GetSchema("tables")=所有表,包括系统表。 tbl2=conn.GetSchema() '=不大支持的方法 dt=conn.GetoleDbSchematable(oleDbSchemaGuID.tables,NewObject(){nothing,"table"}) Me.ListBox1.Items.Clear() ForiAsInteger=0Todt.Rows.Count-1 Me.ListBox1.Items.Add(dt.Rows(i)("table_name").ToString()) Next Me.DataGrIDVIEw1.DataSource=tbl Me.DataGrIDVIEw2.DataSource=tbl2 conn.Close() EndSub PrivateSubbutton2_Click(ByValsenderAsSystem.Object,ByValeAsSystem.EventArgs)Handlesbutton2.Click DimtblAsDatatable IfString.IsNullOrEmpty(Me.TextBox1.Text)=FalseThen conn.open() tbl=conn.GetSchema("columns",Me.TextBox1.Text}) Dimrows()AsDaTarow=tbl.Select("","Ordinal_position") Me.ListBox2.Items.Clear() ForEachrowAsDaTarowInrows Me.ListBox2.Items.Add(row.Item("column_name")) Next Me.DataGrIDVIEw2.DataSource=tbl conn.Close() EndIf EndSub PrivateSubListBox1_SelectedindexChanged(ByValsenderAsSystem.Object,ByValeAsSystem.EventArgs)HandlesListBox1.SelectedindexChanged IfMe.ListBox1.SelectedItems.Count>0Then Me.TextBox1.Text=Me.ListBox1.SelectedItem.ToString EndIf EndSub PrivateSubbutton3_Click(ByValsenderAsSystem.Object,ByValeAsSystem.EventArgs)HandlesBtnGetDatatable.Click DimdbAsNewAccessHelper db.connStr=ConnStr IfMe.TextBox1.Text>""Then db.open() Me.DataGrIDVIEw3.DataSource=db.GetDataVIEw("select*from"&Me.TextBox1.Text) EndIf EndSub EndClass总结
以上是内存溢出为你收集整理的VB.Net程序设计:ADO.Net读取Access表架构全部内容,希望文章能够帮你解决VB.Net程序设计:ADO.Net读取Access表架构所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)