-----------------------------------------------------------
New Message on BDOTNET
-----------------------------------------------------------
From: vipin4dotnet
Message 1 in Discussion
Hello Folks, I am inserting username and password in sql
dbase.One more field User ID is Auto Incremented. The Insertion
of Data is fine , But Every Single Transaction is Inserting
Duplicate Rows. User ID User Name
Password 1 my name mypasswrd
2 my name mypasswrd
In Table the follw. Properties are set(Userr ID)
Identity - yes Identity Seed
- 1 Identity Increment - 1 Also Note: ID
(declrd int type) = cmd.executescalar() is always returning User
ID = 0 The Code is as Follows - Sub Btn_Click(Sender As Object, E As
EventArgs)
dim strsql as string = "insert into register([username],password) & _ "values
(@uname,@pwd) "
dim constr as string = "server=localhost;database=cardb;user & id=sa;password=;"
dim ds as new dataset()
dim con as new sqlconnection(constr)
dim cmd as new sqlcommand(strsql,con)
dim ID as integer
cmd.parameters.add("@uname",sqldbtype.varchar,50)
cmd.parameters.add("@pwd",sqldbtype.varchar,50)
cmd.parameters("@uname").value = txtuname.text
cmd.parameters("@pwd").value=txtpwd.text
con.open()
ID = cmd.executescalar() ' ID is Always Returned 0
cmd.executereader()
con.close()
response.cookies("newuser").value = txtuname.text
response.cookies("UserID").value = ID
response.redirect("conform.aspx")
End Sub
-----------------------------------------------------------
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]