Click here to Skip to main content
15,896,278 members
Home / Discussions / C#
   

C#

 
QuestionSetting where Forms should show Pin
Tehshort29-May-06 9:24
Tehshort29-May-06 9:24 
AnswerRe: Setting where Forms should show [modified] Pin
Rei Miyasaka29-May-06 10:37
Rei Miyasaka29-May-06 10:37 
QuestionAdd node to TreeList Pin
Dima Filipiuk29-May-06 9:24
Dima Filipiuk29-May-06 9:24 
AnswerRe: Add node to TreeList Pin
leppie29-May-06 12:54
leppie29-May-06 12:54 
QuestionCan not use INSERT INTO for Date/Time Variable? Pin
surasaku29-May-06 8:57
surasaku29-May-06 8:57 
AnswerRe: Can not use INSERT INTO for Date/Time Variable? Pin
Christopher Duncan29-May-06 9:55
Christopher Duncan29-May-06 9:55 
AnswerRe: Can not use INSERT INTO for Date/Time Variable? Pin
Guffa29-May-06 10:01
Guffa29-May-06 10:01 
AnswerRe: Can not use INSERT INTO for Date/Time Variable? Pin
Guffa1-Jun-06 11:55
Guffa1-Jun-06 11:55 
surasaku wrote:
Hi Guffa,

Thanks for reply my message. I use Access database.Could you please see my code below? After debugging,the error message is "Syntax error in INSERT INTO Statement". Where is it wrong?

[Code]
string sql2;
string ContentUpdate = textBox2.Text;
DataView dv4 = new DataView(Dset.Tables["myData"]);
dv4.RowFilter = "Date =#"+dateselect+"#";
if (dv4.Count!=0)
sql2 = "UPDATE Content SET Content = '"+ContentUpdate+"' " +
"WHERE Date = #"+dateselect+"#";
else
sql2 = "INSERT INTO Content(Date) VALUES(#2006-05-30#)";
OleDbCommand cmd = new OleDbCommand();
OleDbTransaction trans;
try
{
conn.Open();
trans = conn.BeginTransaction();
cmd.Connection = conn;
cmd.CommandText = sql2;
cmd.Transaction = trans;
cmd.ExecuteNonQuery();
if(MessageBox.Show("Are you sure to Save data?","Data
Saving",MessageBoxButtons.OKCancel) == DialogResult.OK)
trans.Commit();
else
trans.Rollback();

}
catch(Exception ex)
{
MessageBox.Show(ex.Message.ToString());
}
finally
{
conn.Close();
}


Date is a reserved keyword. Change the field name, or if that is not possible, use brackets [] around the field name in the query.

---
b { font-weight: normal; }

QuestionUsing PathGradientBrush Pin
JuanAlbertoMD29-May-06 8:33
JuanAlbertoMD29-May-06 8:33 
QuestionHow to send e-mail Pin
ventomito29-May-06 7:39
ventomito29-May-06 7:39 
AnswerRe: How to send e-mail Pin
Guffa29-May-06 8:13
Guffa29-May-06 8:13 
GeneralRe: How to send e-mail Pin
ventomito29-May-06 8:31
ventomito29-May-06 8:31 
GeneralRe: How to send e-mail Pin
Christopher Duncan29-May-06 10:01
Christopher Duncan29-May-06 10:01 
QuestionClick event on a user control Pin
Ista29-May-06 7:07
Ista29-May-06 7:07 
QuestionCollision Detection Using Regions [modified] Pin
Tristan Rhodes29-May-06 7:02
Tristan Rhodes29-May-06 7:02 
Questionattach a database to sql Pin
shabonaa29-May-06 6:24
shabonaa29-May-06 6:24 
AnswerRe: attach a database to sql Pin
Colin Angus Mackay29-May-06 6:48
Colin Angus Mackay29-May-06 6:48 
QuestionConvert Image to byte[] Pin
hung_ngole29-May-06 5:41
hung_ngole29-May-06 5:41 
AnswerRe: Convert Image to byte[] Pin
A.A.29-May-06 6:42
A.A.29-May-06 6:42 
QuestionName property in PropertyGrid Pin
navin.tirodkar29-May-06 5:27
navin.tirodkar29-May-06 5:27 
QuestionSynchronizing the calls to a function Pin
coolestCoder29-May-06 5:12
coolestCoder29-May-06 5:12 
AnswerRe: Synchronizing the calls to a function [modified] Pin
Ravi Bhavnani29-May-06 5:32
professionalRavi Bhavnani29-May-06 5:32 
GeneralRe: Synchronizing the calls to a function Pin
Guffa29-May-06 8:18
Guffa29-May-06 8:18 
Questionproblem with compiling C++ files Pin
e_LA29-May-06 4:45
e_LA29-May-06 4:45 
AnswerRe: Cannot show class methods in another class Pin
Sean Michael Murphy29-May-06 4:35
Sean Michael Murphy29-May-06 4:35 

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.