Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > How to retrieve data using sql

Reply
Thread Tools

How to retrieve data using sql

 
 
mausimo mausimo is offline
Junior Member
Join Date: Sep 2009
Posts: 4
 
      10-05-2009
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.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM
Newbie VB ADO.Net Code to retrieve data from SQL table Mark B ASP .Net 0 05-07-2008 09:11 AM
How to store/retrieve binary data in/from SQL server DB? =?Utf-8?B?ZGF2aWQ=?= ASP .Net 4 07-07-2006 04:50 PM
Retrieve SQL Data via VB Code (not sqldatasource control) =?Utf-8?B?VmVhcg==?= ASP .Net 1 03-21-2006 04:08 AM
Tools to extract data from SQL database and convert it into XML & insert XML data into SQL databases Harry Zoroc XML 1 07-12-2004 10:10 PM



Advertisments