View Full Version : error message

03-04-2007, 05:53 PM
hi all,
i am not sure wat this error means..would really appreciate it if someone cld help...really in need of help...thanks

Parameterized Query '(@Lead_Name nvarchar(500),@Address nvarchar(1000),@Office_Phone ' expects parameter @Lead_Name, which was not supplied.

wat does it mean?? and how to fix this?


03-05-2007, 02:19 AM
Sounds like you have a stored procedure that has some errors in it, or else you have a parameter for your stored procedure for which you haven't supplied a value. It would be helpful if you'd show us your code.

03-05-2007, 06:43 AM
Sounds like you have a stored procedure that has some errors in it, or else you have a parameter for your stored procedure for which you haven't supplied a value. It would be helpful if you'd show us your code.

sure...the code is. i hv bolded the error where it occurs :

<script language="VB" runat="server">

Dim objConnection As Data.SqlClient.SqlConnection

Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs)
objConnection = New Data.SqlClient.SqlConnection("Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\ASPNETDB.MDF;Integrated Security=True;User Instance=True")

End Sub

Sub AddAccounts()
Dim objCommand As Data.SqlClient.SqlCommand
Dim strSQL As String

strSQL = "INSERT INTO SFA1AccountsDetails " _
& "([Accounts Name], , [Office Phone], Mobile, Fax, [Company Name], Industry, [Annual Revenue]) " _
& "VALUES (@Lead_Name, @Address, @Office_Phone, @Mobile, @Fax, @Company, @Industry, @Annual_Revenue)"

objCommand = New Data.SqlClient.SqlCommand(strSQL, objConnection)

' Add parameters that our SQL command takes:
objCommand.Parameters.Add(New Data.SqlClient.SqlParameter("@Lead_Name", Data.SqlDbType.NVarChar, 500))
objCommand.Parameters.Add(New Data.SqlClient.SqlParameter("@Address", Data.SqlDbType.NVarChar, 1000))
objCommand.Parameters.Add(New Data.SqlClient.SqlParameter("@Office_Phone", Data.SqlDbType.NVarChar, 20))
objCommand.Parameters.Add(New Data.SqlClient.SqlParameter("@Mobile", Data.SqlDbType.NVarChar, 20))
objCommand.Parameters.Add(New Data.SqlClient.SqlParameter("@Fax", Data.SqlDbType.NVarChar, 20))
objCommand.Parameters.Add(New Data.SqlClient.SqlParameter("@Company", Data.SqlDbType.NVarChar, 500))
objCommand.Parameters.Add(New Data.SqlClient.SqlParameter("@Industry", Data.SqlDbType.NVarChar, 300))
objCommand.Parameters.Add(New Data.SqlClient.SqlParameter("@Annual_Revenue", Data.SqlDbType.Money))


objCommand.Parameters("@Lead_Name").Value = CStr(Request.Form("DetailsView1.Fields.TextBox1"))
objCommand.Parameters("@Address").Value = CStr(Request.Form("DetailsView1.Fields.TextBox6"))
objCommand.Parameters("@Office_Phone").Value = CStr(Request.Form("DetailsView1.Fields.TextBox7"))
objCommand.Parameters("@Mobile").Value = CStr(Request.Form("DetailsView1.Fields.TextBox8"))
objCommand.Parameters("@Fax").Value = CStr(Request.Form("DetailsView1.Fields.TextBox9"))
objCommand.Parameters("@Company").Value = CStr(Request.Form("DetailsView1.Fields.TextBox3"))
objCommand.Parameters("@Industry").Value = CStr(Request.Form("DetailsView1.Fields.TextBox4"))
objCommand.Parameters("@Annual_Revenue").Value = CInt(Request.Form("DetailsView1.Fields.TextBox11"))


End Sub


basically, wat i want to do is to get the values that are in the textbox(which are in the DetailsView) and insert into the db.

03-05-2007, 03:55 PM

perhaps should be

03-08-2007, 01:01 AM

perhaps should be

nope...it din work...i think u knw...there are no values there bcoz that code is in the same page of where the values has not gone to the server..thats y request.form does not work...maybe by refreshing the page again then i can use request.form again i guess....or i redirect it to another page and use the code there....


03-15-2007, 04:39 PM
Does Response.Write(CStr(Request.Form("DetailsView1.TextBox1"))) return a value?

If it is in the same page why wait for a postback to retrieve the values?

Can you not simply access the textbox.value and not use request.form ?


objCommand.Parameters("@Lead_Name").Value = TextBox1.Value

or perhaps objCommand.Parameters("@Lead_Name").Value = DetailsView1.TextBox1.Value

Designer Websites (http://www.designer-websites.co.uk)

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum