• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 760
  • Last Modified:

VB.NET and Stored Procedures sp_Databases

Hello,

In our of our VB.NET form, we are using system stored procedure sp_databases to return list of databases. It works fine. Our SQL Server is 2000 and dedicated. This database list is shown in the combo box. It works fine.

Now in production environemtn user runs our EXE and connects to a dedicated SQL Server 2005. But he cannot see any database list in the combo box. Why? If user can connect to SQL Server 2005 and can perform table updates using other forms, why he does not see the database list on combo box? whereas if sp_databases is ruin directly from server, the list of database is shown.

Any idea?

Regards,
VJ
0
vj_mi
Asked:
vj_mi
  • 5
  • 4
2 Solutions
 
Bob LearnedCommented:
Are you getting an exceptions here?  

Bob
0
 
vj_miAuthor Commented:
No Bob ... no exceptions are shown ... rather it works very well on our SQL 2000.

Regards,
Vilas
0
 
Bob LearnedCommented:
Is this a simple connection and call to the database to get sp_Databases to execute?

Bob
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
vj_miAuthor Commented:
Yes ... a simple connection and then I call sp_databases and fill the return list of databases in combo box.

VJ
0
 
Bob LearnedCommented:
If you have a DataSet/DataTable, then you are saying the table.Rows.RecordCount = 0?  Did you check this?

Bob
0
 
vj_miAuthor Commented:
After calling the sp, I use the following:

sqlDT_DB = ds_DB.Tables(0)

For each dRow in sqlDT_DB.Rows
     'code to add item to combo box
Next

Regards,
Vilas
0
 
vj_miAuthor Commented:
This is becoming very urgent ... So I am increasing the points!

VJ
0
 
Bob LearnedCommented:
Have you met the permissions requirement?

  Requires CREATE DATABASE, or ALTER ANY DATABASE, or VIEW ANY DEFINITION permission, and must have access   permission to the database. Cannot be denied VIEW ANY DEFINITION permission.

Bob
0
 
Éric MoreauSenior .Net ConsultantCommented:
have you tried to query the this view from the master database:
SELECT* FROM sys.databases
0
 
Bob LearnedCommented:
Schema: How do I list the databases on my server?
http://www.aspfaq.com/show.asp?id=2456

You can also use the system tables, but this is not the recommended approach, since system table functionality could change in a future version of SQL Server.

Bob
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

  • 5
  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now