View Full Version : what does this error mean? (Unclosed quotation mark after the character string ''.)
Rai_87
04-28-2008, 07:30 AM
Can anyone help me wif this error cos this error have bother me for days.....
and this is my code:
MemoryStream stream = new MemoryStream();
cmd = new SqlCommand(commandString.ToString(), connect);
SqlCommand command = new SqlCommand("SELECT CompanyLogo FROM CompleteUserDetails WHERE UserId = (SELECT UserId FROM aspnet_User WHERE UserName='", connect);
byte[] storedImage = (byte[])command.ExecuteScalar();
stream.Write(storedImage, 0, storedImage.Length);
Bitmap bitmap = new Bitmap(stream);
Response.ContentType = "Image/jpeg";
bitmap.Save(Response.OutputStream, System.Drawing.Imaging.ImageFormat.Jpeg);
cmd.Parameters.AddWithValue("@CompanyLogo", image);
cmd.ExecuteNonQuery();
connect.Close();
when i debug the program it will hang on byte[] storedImage = (byte[])command.ExecuteScalar(); and it will post that error
boogyman
04-28-2008, 12:42 PM
it means that you are missing a quotation mark
SqlCommand command = new SqlCommand("SELECT CompanyLogo FROM CompleteUserDetails WHERE UserId = (SELECT UserId FROM aspnet_User WHERE UserName='", connect);
you are also missing the a value for "Username" variable you are trying to grab in your secondary query. if you need to, break out the two queries... or just complete the one you have there
SqlCommand command = new SqlCommand("
SELECT CompanyLogo FROM CompleteUserDetails WHERE UserId =
(SELECT UserId FROM aspnet_User WHERE UserName='__________')", connect);
Rai_87
04-29-2008, 02:52 AM
if i wan to select any member in table to allow them to change or edit their image, how should write the select command...... help me out pls =D
boogyman
04-29-2008, 01:01 PM
if i wan to select any member in table to allow them to change or edit their image, how should write the select command...... help me out pls =D
If you are talking about grabbing 1 person's information than you need some way to identify that person. whether it by by the username or userid or some other unique identification method.
talking about this from a "users perspective" you could probably use session values that you create when a user logs in, however if you are talking in an administrative perspective, it would probably be easier if you passed in the user name/id as a get variable in the url, than sanitized it and grabbed the information about the user that way...
without knowing your ultimate goal, there really isn't 1 thing I can tell you, but regardless of the method you use, in the way you wish to obtain it for that query, your results need to return only 1 record, so be sure to find a way to uniquely identify the user
Rai_87
04-30-2008, 01:00 AM
i have encounter an error when i debug and the program stop executing at:stream.Write(storedImage, 0, storedImage.Length); and the error state that Object reference not set to an instance of an object. what does the error mean and how can solve that error?
boogyman
04-30-2008, 12:39 PM
byte[] storedImage = (byte[])command.ExecuteScalar();
stream.Write(storedImage, 0, storedImage.Length);
I am not familiar with the language you are using (ASP?? :confused:), but in all the programming I have done, it appears the top line is missing some type of delimiter around
byte[] storedImage =
It looks like you are declaring a new "byte" array key, and assigning it to storedImage? ??
lol im totally lost... can you explain what you are trying to accomplish in those lines?
Rai_87
05-02-2008, 01:17 AM
i am using asp.net for the project and i am trying to read the data using byte array and streaming data......
Aisya
04-19-2011, 09:08 AM
I have a problem with this error ... I cant find the solution ... the situation is, this error only occur once ... once i key in such as " abc'' " , then the error statement will come out but if i try to key the same thing for the 2nd time, the error are no longer appear.
I'll give you the code....I really needs help here T.T
<
Case "UPT"
On Error GoTo ParaUpt1:
intCfmMsg = DispMsg(Msg_Save)
If intCfmMsg <> vbYes Then
Call MoveDbToScreen
Call FormatFields
Else
Set CurrRs = VSHc.Open_HcFamily(CnnLoc, 3, 1, gintComp_Cd, gstrEmp_no, fnstrRelationship(cboRelationship.Text), fnstrAppendSingleQuote(Trim(txtName)))
If CurrRs.RecordCount > 0 And UCase(Trim(txtName)) <> UCase(Trim(txtName1)) Then
Call DispError(Msg_Exist)
txtName.SetFocus
Exit Sub
End If
CurrRs.Close
'
Set CurrRs = VSHc.Open_HcFamily(CnnLoc, 3, 1, gintComp_Cd, gstrEmp_no, fnstrRelationship(cboRelationship.Text), fnstrAppendSingleQuote(Trim(txtName1)))
'Set CurrRs = VSHc.Open_HcFamily(CnnLoc, 3, 1, gintComp_Cd, gstrEmp_no, fnstrRelationship(cboRelationship.Text), fnstrAppendSingleQuote(Trim(txtName)))
If CurrRs.RecordCount > 0 Then
Call MoveScreenToDb
CurrRs.Update
Call UpdRelvNames
End If
End If
txtName1 = ""
txtName.Enabled = True
txtRelationship.Enabled = True
cboRelationship.Enabled = True
Call Rtn_Enable(1)
txtEmp_No1.Enabled = True
cmdFindEmp.Enabled = True
CmdFind.SetFocus
End Select
Exit Sub
ParaAdd1:
Me.MousePointer = 0
If Str(Err.Number) = "-2147217900" Then
Call DispError(Msg_Exist)
txtRelationship.SetFocus
Else
strErrMsg = "Error # " & Str(Err.Number) & " was generated by " _
& Err.Source & Chr(13) & Err.Description
MsgBox strErrMsg, vbCritical, "Error"
End If
Set CurrRs = VSHc.Open_HcFamily(CnnLoc, 2, 1, gintComp_Cd, gstrEmp_no)
Exit Sub
ParaUpt1:
strErrMsg = "Error # " & Str(Err.Number) & " was generated by " _
& Err.Source & Chr(13) & Err.Description
Me.MousePointer = 0
MsgBox strErrMsg, vbCritical, "Error"
End Sub
>
djr33
04-19-2011, 09:24 PM
I am closing this discussion because it is three years old and I don't think your question is related. Start a new discussion if you have a new question. You can post a link to this discussion if there is something important here.
Powered by vBulletin® Version 4.2.2 Copyright © 2021 vBulletin Solutions, Inc. All rights reserved.