-----------------------------------------------------------
New Message on BDOTNET
-----------------------------------------------------------
From: lohith24
Message 2 in Discussion
Hi Ravi, // SqlConnection myConnection Here
SqlCommand myCommand;
SqlTransaction myTransaction = null; myConnection.Open();
string strSql = "select * from UserName where UserName='" +
UserName.Text.Trim() + "'";
myCommand = new SqlCommand( strSql, myConnection );
SqlDataReader reader = myCommand.ExecuteReader(); bool bFound =
false; if( reader.Read() )
{
bFound = true;
} reader.Close(); if( bFound )
{
LoginMessage.Text =
"The user name you chose already exists.";
myConnection.Close();
return;
} myTransaction =
myConnection.BeginTransaction( IsolationLevel.ReadCommitted,
"NewUser" );
strSql = "insert into UserName (UserName,Password) VALUES ('" +
UserName.Text.Trim() + "','" +
Password.Text.Trim() + "') select @ID = @@IDENTITY";
myCommand = new SqlCommand( strSql, myConnection, myTransaction );
myCommand.Parameters.Add( "@ID", SqlDbType.Int );
myCommand.Parameters["@ID"].Direction =
ParameterDirection.Output;
myCommand.ExecuteNonQuery();
int nID = Convert.ToInt32( myCommand.Parameters["@ID"].Value );
myCommand = new SqlCommand( "insert into UserDetails(ID) VALUES (" +
Convert.ToString( nID ) +
")", myConnection, myTransaction );
myCommand.ExecuteNonQuery(); myTransaction.Commit();
Do some changes based on userDetails table columns. I hope this will help
you!!!!!!!!! Lohith
-----------------------------------------------------------
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]