-----------------------------------------------------------
New Message on BDOTNET
-----------------------------------------------------------
From: vipin4dotnet
Message 1 in Discussion
Hello Folks,
I am trying to Insert username and password in the Database-"login"
and TableName-"Users". the Fields are-
UserID | UserName | Password Getting Error:-
Cannot insert the value NULL into column 'UserID', table 'login.dbo.Users';
olumn does not allow nulls. INSERT fails. NOTE- UserID is Primary Key Hence It
should be Auto-Incremented.
I am trying to Insert with the following Script:- <script runat="server">
Sub Btn_Click(Sender As Object, E As EventArgs)
dim strsql as string = "insert into users(username,password) values _
"(@uname,@pwd) SELECT @@IDENTITY as 'Identity'"
dim constr as string = "server=localhost;database=login;user id=sa;password=;"
' dim ds as new dataset()
dim con as new sqlconnection(constr)
dim cmd as new sqlcommand(strsql,con)
cmd.parameters.add("@uname",sqldbtype.varchar,20)
cmd.parameters.add("@pwd",sqldbtype.varchar,15)
cmd.parameters("@uname").value = txtuname.text '
textbox for username
cmd.parameters("@pwd").value=txtpwd.text '
textbox for password
con.open()
cmd.executereader()
con.close()
............................................
Please Guide me Whats wrong with the above script... Thanks
Regards Vipin
-----------------------------------------------------------
To stop getting this e-mail, or change how often it arrives, go to your E-mail
Settings.
http://groups.msn.com/BDotNet/_emailsettings.msnw
Need help? If you've forgotten your password, please go to Passport Member Services.
http://groups.msn.com/_passportredir.msnw?ppmprop=help
For other questions or feedback, go to our Contact Us page.
http://groups.msn.com/contact
If you do not want to receive future e-mail from this MSN group, or if you received
this message by mistake, please click the "Remove" link below. On the pre-addressed
e-mail message that opens, simply click "Send". Your e-mail address will be deleted
from this group's mailing list.
mailto:[EMAIL PROTECTED]