How to retrieve data using sql

Discussion in '.NET' started by mausimo, Oct 5, 2009.

  1. mausimo

    mausimo

    Joined:
    Sep 24, 2009
    Messages:
    4
    Likes Received:
    0
    What i am trying to do is retrieve the current date by using sql so that the date is dependant on the server, not the user's computer. Here is what i got:

    // create the data adapter
    SqlDataAdapter dataAdapter = new SqlDataAdapter("declare @Date datetime set @Date = getdate()", myCon);

    // create the DataSet
    DataSet dataSet = new DataSet();

    // fill the DataSet using our DataAdapter
    dataAdapter.Fill(dataSet);

    When i run this, it complies fine, however the dataset does not get any data.
    Im pretty sure my problem is that a DataSet is looking for a table of data, where this sql command does not return a table of data. I need something similar to this, i just want to retrieve the date from the server.
     
    mausimo, Oct 5, 2009
    #1
    1. Advertisements

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?VmVhcg==?=
    Replies:
    1
    Views:
    5,249
    =?Utf-8?B?UGhpbGxpcCBXaWxsaWFtcw==?=
    Mar 21, 2006
  2. Harry Zoroc
    Replies:
    1
    Views:
    1,168
    Gregory Vaughan
    Jul 12, 2004
  3. irfangani@gmail.com
    Replies:
    1
    Views:
    799
    =?Utf-8?B?QWx0YWYgQWwtQW1pbiBOYWp3YW5p?=
    May 19, 2006
  4. =?Utf-8?B?ZGF2aWQ=?=

    How to store/retrieve binary data in/from SQL server DB?

    =?Utf-8?B?ZGF2aWQ=?=, Jul 6, 2006, in forum: ASP .Net
    Replies:
    4
    Views:
    10,360
    sloan
    Jul 7, 2006
  5. Bhavesh
    Replies:
    0
    Views:
    553
    Bhavesh
    Jul 16, 2007
  6. Bhavesh
    Replies:
    5
    Views:
    921
    Bhavesh
    Jul 18, 2007
  7. Mark B
    Replies:
    0
    Views:
    493
    Mark B
    May 7, 2008
  8. Kiran
    Replies:
    4
    Views:
    355
    Kiran
    Oct 14, 2003
Loading...