Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
neojapanese
Starting Member
13 Posts |
Posted - 2006-03-03 : 17:00:35
|
Compiler Error Message: BC30456: 'AddWithValue' is not a member of 'System.Data.SqlClient.SqlParameterCollection'Compilation Error Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately. Compiler Error Message: BC30456: 'AddWithValue' is not a member of 'System.Data.SqlClient.SqlParameterCollection'.Line 29: cmdSelect.Parameters.AddWithValue("@username", txtUsername.Text)this is my code is here below_______________<%@ Page Language="VB" %><%@ Import Namespace="System.Data" %><%@ Import Namespace="System.Data.SqlClient" %><%@ Import Namespace="System.Threading" %><Script Runat="Server">Sub Button_Click( s As Object, e As EventArgs )Dim conMyData As SqlConnectionDim cmdSelect As SqlCommandDim parmReturnValue As SqlParameterDim intResult As Integer'Server=cedantsql1.cedant.com;uid=NYREIDB;pwd=sushiboy;database=neojapanese1_NYREIDBIf IsValid ThenconMyData = New SqlConnection("hidden")cmdSelect = New SqlCommand("DBRegister", conMyData)'GetParamcmdSelect.CommandType = CommandType.StoredProcedureparmReturnValue = cmdSelect.Parameters.Add( "RETURN_VALUE", SqlDbType.Int )parmReturnValue.Direction = ParameterDirection.ReturnValue'cmdSelect = New SqlCommand( "GetParam" , conMMTMP)'cmd.Parameters.AddWithValue("@CategoryName", category)cmdSelect.Parameters.AddWithValue("@username", txtUsername.Text)'cmdSelect.Parameters.AddWithValue("@username", txtUsername.Text)cmdSelect.Parameters.AddWithValue("@password", txtPassword.Text)conMyData.Open()cmdSelect.ExecuteNonQuery()intResult = cmdSelect.Parameters( "RETURN_VALUE" ).ValueconMyData.Close()If intResult = - 1 ThenlblMessage.Text = "Username Already Registered!"ElseFormsAuthentication.RedirectFromLoginPage( txtUsername.Text, False )End IfEnd IfEnd Sub</Script><html><head><title>Register.aspx</title></head><body><form Runat="Server"><h2>Please Register</h2><p><b>Login information:</b> </p><asp:LabelID="lblMessage"ForeColor="Red"Font-Bold="True"EnableViewState="False"Runat="Server" /><p><b>Username:</b><br><asp:TextBoxID="txtUsername"Runat="Server" /><asp:RequiredFieldValidatorText="Required!"Runat="Server" /><p><b>Password:</b><br><asp:TextBoxID="txtPassword"Runat="Server" /><asp:RequiredFieldValidatorText="Required!"Runat="Server" /><p> <p><b>Personal information:</b></form><p><b>First Name:</b><br><asp:TextBoxID="txtFN"Runat="Server" /><asp:RequiredFieldValidatorText="Required!"Runat="Server" /></p><p><b>Last Name:</b><br><asp:TextBoxID="txtLN"Runat="Server" /><asp:RequiredFieldValidatorText="Required!"Runat="Server" /></p><p><b>Email:</b><br><asp:TextBoxID="txtUsername2"Runat="Server" /><asp:RequiredFieldValidatorText="Required!"Runat="Server" /></p><p> </p><p><asp:ButtonText="Register!"OnClick="Button_Click"Runat="Server" /></p><p> </p></body></html> |
|
aaronlj
Starting Member
1 Post |
Posted - 2006-03-22 : 14:57:49
|
I am getting a similar error and I have not been able to fix it. Did you find a fix? |
 |
|
MichaelP
Jedi Yak
2489 Posts |
Posted - 2006-03-22 : 15:41:13
|
Maybe a different provider supports that, but I've never seen that notation with .Net 1.0 or 1.1.I've always done this:cmdSelect.Parameters.Add("@Username", SqlDbType.VarChar, 50).Value = txtUsername.Text Michael<Yoda>Use the Search page you must. Find the answer you will. Cursors, path to the Dark Side they are. Avoid them, you must. Use Order By NewID() to get a random record you will.</Yoda>Opinions expressed in this post are not necessarily those of TeleVox Software, inc. All information is provided "AS IS" with no warranties and confers no rights. |
 |
|
bhar
Starting Member
9 Posts |
Posted - 2006-03-24 : 05:42:51
|
Hi,Alternatively, you can do like this.prmcat = New SqlParameter()prmcat.ParameterName="@mcode"prmcat.Direction=ParameterDirection.Inputprmcat.SqlDbType=SqlDbType.Charprmcat.Size=6prmcat.Value=mcode.textcomSelect.Parameters.Add(prmcat) |
 |
|
|
|
|
|
|