Jump to content

Parse Error in SQL, please help


This topic is 6294 days old. Please don't post here. Open a new topic instead.

Recommended Posts

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(, , , -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):D [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:Inetpubmaxrootsupport_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

Link to comment
Share on other sites

Thank you all for trying. I got it. I just had to insert double quotes for the table name and for all the field names. I did that by using char c = (char)34; in C# as I am prgramming in c#. This small thing ate my day. :D

Link to comment
Share on other sites

This topic is 6294 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.