如何调用或查看sql server 2000的所有数据库?

编程入门 行业动态 更新时间:2024-10-23 18:21:46
本文介绍了如何调用或查看sql server 2000的所有数据库?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

如何在组合框中显示sql server 2000的所有数据库,这意味着该后面的代码是什么 如果在sql server中证明有2个或3个以上的数据库,并且我想在列表中或组合框中显示所有列表,请单击

how can show all database of sql server 2000 in my combo-box mean what will be code behind that if there are more then 2 or 3 database attested in sql server and i want to show all list in list or in combo box

推荐答案

Try: Try: SELECT * FROM information_schema.tables

这是显示所有表,我想显示所有数据库" 糟糕! :O

"this is show all table i want to show all database" Oops! :O

Dim con As New SqlConnection("Data Source=GRIFFPC\SQLEXPRESS;Integrated Security=True") con.Open() Dim cmd As New SqlCommand("sp_databases", con) cmd.CommandType = CommandType.StoredProcedure Dim read As SqlDataReader = cmd.ExecuteReader() While read.Read() Console.WriteLine(DirectCast(read("DATABASE_NAME"), String)) End While

您将需要更改实例名称,并且可能需要UID/密码组合而不是集成安全性.

You will need to change teh instance name, and may need a UID/Password combo instead of Integrated Security.

此 [^ ]可能会对您有所帮助. This[^] might help you.

Dim conn As New SqlConnection(connString) Dim strSQL As String = "SELECT name FROM master.sys.databases" Dim DA As New SqlDataAdapter(strSQL, conn) Dim DS As New DataSet DA.Fill(DS, "dblist") For i = 0 To ds.Tables(0).Rows.Count - 1 cmbdb.items.add(ds.Tables(0).Rows(i).Item(0).Tostring()) Next

更多推荐

如何调用或查看sql server 2000的所有数据库?

本文发布于:2023-10-29 03:35:10,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1538607.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:数据库   sql   server

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!