Parse Error in SQL -
01-02-2007
, 03:46 PM
Hi all,
I have the following in my ASP.NET page.
object rs = new object();
ADODB.Connection conn = new ADODB.Connection();
//ADODB.Connection conn = Server.CreateObject(ADODB.Connection);
try
{
conn.Mode = ADODB.ConnectModeEnum.adModeReadWrite;
conn.Open(<DSN>, <USER NAME>, <PASSWORD>, -1);
string query = "INSERT INTO Employee Support-010123(Location) VALUES('"
+ txtLocName.Text + "');";
conn.Execute(query, out rs, 0);
}
catch (System.Exception ex)
{
txtOrgName.Text = ex.ToString();
}
finally
{
conn.Close();
}
Here, txtLocName.Text is a text box.
Initially, I was getting errors that the required provider could not be
found but I believe I fixed that since it is not giving that error
anymore. It has now started giving the following error:
System.Runtime.InteropServices.COMException (0x80004005):
[DataDirect][ODBC SequeLink driver][ODBC Socket][DataDirect][ODBC
FileMaker driver][FileMaker]Parse Error in SQL at
ADODB.ConnectionClass.Execute(String CommandText, Object&
RecordsAffected, Int32 Options) at
ASP.Support_form_aspx.Page_Load(Object sender, EventArgs e) in
C:\Inetpub\maxroot\suppor t_form.aspx:line 80
Please help, I have spent so many hours on this but am still not able
to figure out where I am going wrong.
Thank you all in advance,
MAX |