Click here to Skip to main content
16,004,906 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hai i am passing the Value in query string ,at the time i am receiving this error this is my code:

VB
Protected Sub Submit_Click(ByVal sender As Object, ByVal e As EventArgs) Handles Submit.Click
        Try
            oDr = oMainForm.oConn.RunQuery("insert into BUSON_ASSIGN(Callid,ClientId,CallSubject,CallDescription,Priority,CallType,Status,FeedBack,RspDateTime,Assignto)values('" + txtCallId.Text + "','" + ClientId.SelectedValue + "','" + CallSubject.Text + "','" + CallDesc.Text + "','" + Priority.SelectedValue + "','" + CallType.SelectedValue + "','" + CallStatus.SelectedValue + "','" + Feedback.Text + "', getDate() ,' " + DropDownConsultant.SelectedItem.Text() + "')")
            Errlbl0.Text = ""

            Dim Body As String = Me.PopulateBody("Hello", _
                                                 "I am Assign one Call Log for You Please Click Hear to View the Call Log", _
                                                "http://localhost:3482/AssignReport.aspx?UserId=" + txtCallId.Text + "&AssName" = +DropDownConsultant.SelectedItem.Text & _
                                               "", _
            ("" & _
            " " & _
            ""))//hear only i amgeting error
            Me.SendHtmlFormattedEmail("recipient@gmail.com", "Reg Serives Call!", Body)
            MsgBox("Your assign the Call log Your assign the case successfully!!!")
            Response.Redirect("AllCallReport.aspx")
        Catch ex As Exception
            Errlbl0.Text = ex.Message.ToString()

        End Try
    End Sub
Posted
Updated 1-Jul-13 21:20pm
v2
Comments
Richard MacCutchan 2-Jul-13 3:31am    
The first thing you should do is rewrite the above to use proper parameters. As it stands your code is at serious risk from SQL injection.
You have a = sign in that statement; is that correct?

Use cdbl function where require to convert string into double:
Like suppose in your code, if field CallID and ClientId are of double type in database then

cdbl(txtCallId.Text) and
cdbl(ClientId.SelectedValue)
 
Share this answer
 
Well the error tells you the issue, some of your values that you are using are in the format of a string, but they need to be as a type double.

Without knowing your table structure, I would imagine the following are supposed to be doubles:

txtCallId.Text,
ClientId.SelectedValue


I would also suggest you look up how to user parameters in your sql queries as you are very susceptible to SQL Injection attacks through your form based on this code.
(Google search results[^]

If you want to keep your code as it is, I would suggest using the Double.Parse() method to convert the relevant string values to double values and see how you get on.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900