Query is not working in VB.net

  • Hi,

    I am firing "select * from sys.views" or "select * from information_schema.views" in management console and it is giving me views names and definitions(which is my requiresome). While I am trying to run the same query from VB.net, it reurning 0 rows. but "select * from sysobjects/all_objects" is working fine in from VB.net. How to solve this problem?

    I am using SQL Server 2005, VB.net 2003 and connecting both through DSN(ODBC connection).

    Could you suggest any alternative?

    thanks in advance,

    Arup

  • well lets start with the basics; are you sure you are connecting at all? can you select @@version from vb?

    could you be connecting to MASTER, adn thinking you'll see tables in a different database? if you are stepping thru the code, does your LoadDataTable event throw an error in a try-catch, so you don't get data because the error is suppressed?

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!

  • Lowell (3/16/2011)


    well lets start with the basics; are you sure you are connecting at all? can you select @@version from vb?

    could you be connecting to MASTER, adn thinking you'll see tables in a different database? if you are stepping thru the code, does your LoadDataTable event throw an error in a try-catch, so you don't get data because the error is suppressed?

    Hi lowell,

    Thanks for ur reply :). Yes, I am sure that everything is working fine because, in DSN, I have mentioned the proper db name. The basic problem is, while I am using information_schma or sys.views, then it is happening only. For other query, it is running fine. It is not throwing any error, simply not returning any resultset.

    Is it because of am using ODBC? Or I need to set check/uncheck some properties in DSN?

  • Hi,

    I am eagerly waiting for the solution. Please help.

    Alternately, can you provide a query/method through which I can get the view definitons? That will also work for me.

    Regards,

    Arup

  • Hi, This is solved (not sure how).

    I am now using 32 bit odbc on 64 bit OS. It is working fine.

    Thanks a ton to all.

Viewing 5 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply