Advanced Search

Results 1 to 9 of 9

Thread: what does this error mean? (Unclosed quotation mark after the character string ''.)

  1. #1
    Join Date
    Apr 2008
    Posts
    20
    Thanks
    0
    Thanked 1 Time in 1 Post

    Default what does this error mean? (Unclosed quotation mark after the character string ''.)

    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

  2. #2
    Join Date
    Jul 2006
    Location
    just north of Boston, MA
    Posts
    1,806
    Thanks
    13
    Thanked 72 Times in 72 Posts

    Default

    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

    Code:
    SqlCommand command = new SqlCommand("
         SELECT CompanyLogo FROM CompleteUserDetails WHERE UserId = 
         (SELECT UserId FROM aspnet_User WHERE UserName='__________')", connect);

  3. #3
    Join Date
    Apr 2008
    Posts
    20
    Thanks
    0
    Thanked 1 Time in 1 Post

    Default if i wan to select any member in the table how should i write the command

    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
    Last edited by Rai_87; 04-29-2008 at 07:31 AM.

  4. #4
    Join Date
    Jul 2006
    Location
    just north of Boston, MA
    Posts
    1,806
    Thanks
    13
    Thanked 72 Times in 72 Posts

    Default

    Quote Originally Posted by Rai_87 View Post
    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

  5. #5
    Join Date
    Apr 2008
    Posts
    20
    Thanks
    0
    Thanked 1 Time in 1 Post

    Default

    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?

  6. #6
    Join Date
    Jul 2006
    Location
    just north of Boston, MA
    Posts
    1,806
    Thanks
    13
    Thanked 72 Times in 72 Posts

    Default

    byte[] storedImage = (byte[])command.ExecuteScalar();
    stream.Write(storedImage, 0, storedImage.Length);
    I am not familiar with the language you are using (ASP?? ), 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?

  7. #7
    Join Date
    Apr 2008
    Posts
    20
    Thanks
    0
    Thanked 1 Time in 1 Post

    Default i am using asp and i am trying to read the data using byte array and streaming it

    i am using asp.net for the project and i am trying to read the data using byte array and streaming data......

  8. #8
    Join Date
    Apr 2011
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    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
    >

  9. #9
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,156
    Thanks
    262
    Thanked 690 Times in 678 Posts

    Default

    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.
    Daniel - Freelance Web Design | <?php?> | <html>| espa˝ol | Deutsch | italiano | portuguŕs | catalÓ | un peu de franšais | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •