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.
// 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.