Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Insert into SQL table from .aspx
Message
 
À
Tous
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Titre:
Insert into SQL table from .aspx
Divers
Thread ID:
00945715
Message ID:
00945715
Vues:
55
Hi All,

Here is my code behind the page used to insert registration info into a sql table. Everyting works fine except the time when txtHospital.Text includes a single quote, ex: Women's Hospital.
When this is a case insert statement fails with the following error message:
Line 1: Incorrect syntax near 'medical'.
sselect = "execute mktng_insert_registration " & EventId & " , '" & event_date & "' ,'" & event_location & "' ,'" & txtFirstName.Text & "','" & txtLastName.Text & "','" & txtHospital.Text & "','" & txtDept.Text & "','" & txtAddress1.Text & "','" & txtAddress2.Text & "','" & txtCity.Text & "','" & ddlStateSelect.SelectedValue & "','" & txtZip.Text & "','" & txtEmail.Text & "','" & txtPhone1.Text & "-" & txtPhone2.Text & "-" & txtPhone3.Text & "','" & txtExt.Text & "','" & txtFax1.Text & "-" & txtFax2.Text & "-" & txtFax3.Text & "','" & RadioButtonList1.SelectedValue & "','" & RadioButtonList2.SelectedValue & "',''"

new_id = ExecSqlStr(sselect, cn_str)
Any help is appreciated,

Daniel
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform