- protected void btn_Edit_Click(object sender, EventArgs e)
-
{
-
Panel1.Visible = true;
-
Button5.Visible = true;
-
if (FileUpload1.HasFile)
-
{
-
//string filename = Path.GetFileName(FileUpload1.PostedFile.FileName);
-
//FileUpload1.SaveAs(Server.MapPath(filename));
-
string filename = "~/Uploads/" + FileUpload1.FileName;
-
FileUpload1.SaveAs(Server.MapPath(filename));
-
-
conn.Open();
-
if (TextBox10.Text != "")
-
{
-
SqlCommand cmd = new SqlCommand("UPDATE Question_tbl SET ExamName='" + ddl_ExamName.Text + "',SubjectName='" + ddl_SubjectName.Text + "',TopicName='" + ddl_TopicName.Text + "',QuestionLevel='" + ddl_QuestionLevel.Text + "',QuestionMmarking='" + tb_QMarking.Text + "',QuestionType='" + ddl_QType.Text + "',Question='" + tb_Question.Text + "',Option1='" + tb_Option1.Text + "',Option2='" + tb_Option2.Text + "',Option3='" + tb_Option3.Text + "',Option4='" + tb_Option4.Text + "',CorrectOption='" + tb_CorrectOption.Text + "',Solution='" + tb_Solution.Text + "',AImage='" + filename + "' where QuestionId='" + TextBox10.Text + "'", conn);
-
cmd.ExecuteNonQuery();
-
Page.Response.Redirect(HttpContext.Current.Request.Url.ToString(), true);
-
Response.Write("Sucessfully updated..");
-
-
}
-
ClearText();
-
conn.Close();
-
}
-
}
here is my code and it is giving this error.."Incorrect Syntax Near s - Unclosed Quotation Mark After The Character String"
please help in solving this problem its urjent...
2 4502 Rabbit 12,516
Recognized Expert Moderator MVP
Please use code tags when posting code.
The most likely cause is that one of your variables has a quote in its value. You need to either parameterize your query or escape the quotes. Otherwise you open yourself up to these errors and SQL injection attacks.
donbock 2,426
Recognized Expert Top Contributor
Is this a compile-time error or is perhaps a run-time error generated by SQL?
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Carl |
last post by:
Can you tell me what is wrong with this syntax ?
string select = "UPDATE .. " +
"(,,,,,,,
,,,,
,,, ,
, , ) " +
" VALUES
(@id,@clientid,@total,@tps,@tvq,@gtotal,@datefac,@datepay,
|
by: Mark Findlay |
last post by:
Hello Experts!
I am attempting to use the OleDbCommand.ExecuteScaler() function within my
ASP.NET C# web page to perform a simple validation, but receive the
following error:
"Incorrect...
|
by: Iham Sheen |
last post by:
Hi,
When I click at the Update button to commit changes in a MxDataGrid, I get
the error message "Unclosed quotation mark ...." if there is a single quote
in any of the columns.
How can I work...
|
by: iporter |
last post by:
In the following code, the two Response.Write statements output exactly
the same - I can copy and paste both into Query Analyzer, and run them
fine. However, if I comment out line 3, the...
|
by: roamnet |
last post by:
hi
i created database file with .mdf extention ,sql server as a source
and use grid view to display data
there're no problem in data retrieve and display,but i want to edit it
or insert new...
| |
by: =?Utf-8?B?QW5kcmV3?= |
last post by:
Hi,
What is wrong with this code ? I got this error:
" Line 1: Incorrect syntax near 'sp_Collect'. "
which appears at the last line when | call the cm.ExecuteScalar . The sp
takes an int ID...
|
by: karenkksh |
last post by:
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. ...
|
by: dougancil |
last post by:
Can someone please review my code and see where I can be missing information. I get the following error:
Line 1: Incorrect syntax near ','. Unclosed quotation mark before the character string '...
|
by: Omendra |
last post by:
Hi, I am using SQL Server 2005 and i am using Stored Procedure something like :-
I am getting error:-
Msg 170, Level 15, State 1,
Line 18: Incorrect syntax near 'MAX'.
DECLARE @jid AS...
|
by: Aisya |
last post by:
Hye,
I need help to overcome the problem mention above.
My application needs user to key in their details, but when it comes to name some names has an apostrophe, somehow it's okay to save the...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
| |
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...
| |