Click here to Skip to main content
15,898,987 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
the problem statement is
Server Error in '/' Application.

The parameterized query '(@user_no nvarchar(1),@username nvarchar(4),@password nvarchar(5' expects the parameter '@institlisn', which was not supplied.

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.

Exception Details: System.Data.SqlClient.SqlException: The parameterized query '(@user_no nvarchar(1),@username nvarchar(4),@password nvarchar(5' expects the parameter '@institlisn', which was not supplied.

Source Error:


Line 110: cmd1.Parameters.AddWithValue("@map_path", Image2.ImageUrl)
Line 111:
Line 112: cmd1.ExecuteNonQuery()
Line 113: conn.Close()
Line 114: Label1.Text = "تم قبول المشترك "

---------------------------------------

need help to this code :

VB
Dim cmd1 As New SqlCommand("select user_no,username,password,email,institname,institlisn,lisn_path,stutus,mobile,city,area,town,cord_x,cord_y,map_name,map_path from users1", conn)
      Dim da As New SqlDataAdapter(cmd1)
      Dim ds As New DataSet()
      da.Fill(ds, "orders")
      TextBox1.Text = ds.Tables("orders").Rows(i).Item(0).ToString
      TextBox2.Text = ds.Tables("orders").Rows(i).Item(1).ToString
      TextBox3.Text = ds.Tables("orders").Rows(i).Item(2).ToString
      TextBox4.Text = ds.Tables("orders").Rows(i).Item(3).ToString
      TextBox5.Text = ds.Tables("orders").Rows(i).Item(4).ToString
      Image1.ImageUrl = ds.Tables("orders").Rows(i).Item(7).ToString
      TextBox6.Text = ds.Tables("orders").Rows(i).Item(6).ToString
      TextBox7.Text = ds.Tables("orders").Rows(i).Item(8).ToString
      TextBox8.Text = ds.Tables("orders").Rows(i).Item(9).ToString
      TextBox9.Text = ds.Tables("orders").Rows(i).Item(10).ToString
      TextBox10.Text = ds.Tables("orders").Rows(i).Item(11).ToString
      Image2.ImageUrl = ds.Tables("orders").Rows(i).Item(14).ToString




      cmd1.Parameters.Clear()
      cmd1.Parameters.AddWithValue("@user_no", TextBox1.Text)
      cmd1.Parameters.AddWithValue("@username", TextBox2.Text)
      cmd1.Parameters.AddWithValue("@password", TextBox3.Text)

      cmd1.Parameters.AddWithValue("@email", TextBox5.Text)
      cmd1.Parameters.AddWithValue("@institname", TextBox4.Text)
      cmd1.Parameters.AddWithValue("@institlisn", Session("order_institlisn"))

      cmd1.Parameters.AddWithValue("@lisn_path", Image1.ImageUrl)
      cmd1.Parameters.AddWithValue("@stutus", "مشترك جديد")
      cmd1.Parameters.AddWithValue("@mobile", TextBox7.Text)

      cmd1.Parameters.AddWithValue("@city", TextBox8.Text)
      cmd1.Parameters.AddWithValue("@area", TextBox9.Text)
      cmd1.Parameters.AddWithValue("@town", TextBox10.Text)

      cmd1.Parameters.AddWithValue("@cord_x", Session("@cord_x"))
      cmd1.Parameters.AddWithValue("@cord_y", Session("@cord_y"))

      cmd1.Parameters.AddWithValue("@map_name", Session("map_name"))
      cmd1.Parameters.AddWithValue("@map_path", Image2.ImageUrl)

      cmd1.ExecuteNonQuery()
      conn.Close()
      Label1.Text = "تم قبول المشترك "
Posted
Comments
[no name] 30-Jul-13 17:55pm    
If there is a parameterized query in there somewhere, I sure do not see it.
berrymaria 30-Jul-13 20:20pm    
I agree with you.
[no name] 30-Jul-13 20:58pm    
Okay so this is a repost but the answer to your problem that you have to move the addition of your parameters to before you use them. You can't have a paramterized query and use it in da.Fill(ds, "orders") without adding the parameters first.

1 solution

Session("order_institlisn") is likely null. You'll need to check for that.
 
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