Click here to Skip to main content
15,921,716 members
Home / Discussions / Database
   

Database

 
GeneralSQL Administration Through Internet Explorer Pin
nileshmankar20-Aug-03 23:25
nileshmankar20-Aug-03 23:25 
GeneralRe: SQL Administration Through Internet Explorer Pin
[ Jûroehn ]6-Sep-03 6:12
[ Jûroehn ]6-Sep-03 6:12 
GeneralADODB Recordset Question Pin
Abin20-Aug-03 16:38
Abin20-Aug-03 16:38 
GeneralRe: ADODB Recordset Question Pin
Steve S20-Aug-03 22:54
Steve S20-Aug-03 22:54 
GeneralRe: ADODB Recordset Question Pin
Hesham Amin21-Aug-03 5:26
Hesham Amin21-Aug-03 5:26 
GeneralRe: ADODB Recordset Question Pin
Steve S21-Aug-03 6:37
Steve S21-Aug-03 6:37 
GeneralRe: ADODB Recordset Question Pin
Abin21-Aug-03 15:48
Abin21-Aug-03 15:48 
GeneralInserting DateTime value Pin
Francis B.20-Aug-03 5:32
Francis B.20-Aug-03 5:32 
Hi! I have a problem when I try to insert DateTime value in an access database.
I receive this exception: "Syntax error in INSERT INTO statement."

I try two different ways to add Datetime and no one works!
<br />
newDataRow["Timestamp"] = DateTime.Now.ToString();<br />

and
<br />
newDataRow["Timestamp"] = DateTime.Now;<br />

But if I remove all DateTime stuff in my database and my code, I am able to insert data whitout any problem.

Here my code:

DataSet dataSet = new DataSet();
string dbGenConn = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=";
string dbConn = dbGenConn + "fileName.mdb" + "; Persist Security Info=False;";
OleDbConnection conn = new OleDbConnection(dbConn);
conn.Open(); 

OleDbDataAdapter adapter = new OleDbDataAdapter(new OleDbCommand("SELECT * FROM Data", conn));
OleDbCommandBuilder dataCmdBuilder = new OleDbCommandBuilder(adapter);
adapter.Fill(dataSet, "Data");

for(int i = 0; i < items.Length; i++)
{	
	DataRow newDataRow = dataSet.Tables["Data"].NewRow();
	newDataRow["DataID"] = i;
	newDataRow["Timestamp"] = DateTime.Now.ToString();
	newDataRow["Quality"] = 192
	dataSet.Tables["Data"].Rows.Add(newDataRow);	
}

adapter.Update(dataSet, "Data");
conn.Close();

GeneralRe: Inserting DateTime value Pin
Marcel Härry25-Aug-03 11:34
Marcel Härry25-Aug-03 11:34 
Generalget the newly create record ID Pin
Jerome Conus19-Aug-03 23:20
Jerome Conus19-Aug-03 23:20 
GeneralRe: get the newly create record ID Pin
Alexandru Savescu20-Aug-03 0:34
Alexandru Savescu20-Aug-03 0:34 
GeneralRe: get the newly create record ID Pin
Steve S20-Aug-03 0:50
Steve S20-Aug-03 0:50 
GeneralRe: get the newly create record ID Pin
Dr_Sh0ck24-Aug-03 23:52
Dr_Sh0ck24-Aug-03 23:52 
GeneralRe: get the newly create record ID Pin
Tom Archer25-Aug-03 15:41
Tom Archer25-Aug-03 15:41 
GeneralRe: get the newly create record ID Pin
Jerome Conus25-Aug-03 19:02
Jerome Conus25-Aug-03 19:02 
GeneralRe: get the newly create record ID Pin
Tom Archer26-Aug-03 2:00
Tom Archer26-Aug-03 2:00 
QuestionOleDB or Sql? Pin
Alexandru Savescu19-Aug-03 22:28
Alexandru Savescu19-Aug-03 22:28 
AnswerRe: OleDB or Sql? Pin
Brad Sokol22-Aug-03 2:58
Brad Sokol22-Aug-03 2:58 
GeneralNO_DATA - no error information available Pin
bpchia19-Aug-03 20:10
bpchia19-Aug-03 20:10 
GeneralRe: NO_DATA - no error information available Pin
bpchia22-Aug-03 1:43
bpchia22-Aug-03 1:43 
Generalstumped Pin
Shotgun19-Aug-03 18:34
Shotgun19-Aug-03 18:34 
GeneralRe: stumped Pin
Rocky Moore19-Aug-03 22:58
Rocky Moore19-Aug-03 22:58 
GeneralRe: stumped Pin
Shotgun20-Aug-03 1:44
Shotgun20-Aug-03 1:44 
GeneralHelp with sql trigger Pin
Ista19-Aug-03 11:32
Ista19-Aug-03 11:32 
GeneralRe: Help with sql trigger Pin
Jason McBurney21-Aug-03 4:54
Jason McBurney21-Aug-03 4:54 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.