yshie
3/28/2007 2:11:00 PM
Visual Studio 2005
MS SQL Server
i have insert and update statements. they don't produce any errors but no
changes happen in my tables. are there any possible reason for this. i used
sqlcommand and even stored procedures but still the same. i tried QA and they
are working good
this is my insert command.. let's take this first!
using (SqlConnection conn = new SqlConnection())
{
conn.ConnectionString = @"Data Source=.SQLEXPRESS;AttachDbFilename=|DataDirectory|\Mydb.mdf;Integrated
Security=True;Connect Timeout=30;User Instance=True";
conn.Open();
using (SqlCommand cmd = new SqlCommand("SPCust",conn))
{
string autoPW = GeneratePassword();
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.Add("@ID",SqlDbType.VarChar).
Value=textBoxID.Text;
cmd.Parameters.Add("@Passwd", SqlDbType.VarChar).Value
=autoPW;
cmd.ExecuteNonQuery();
labelRegiStat.Text = "Registration Successful! \nPassword is " + autoPW;
}
}
CREATE PROCEDURE dbo.SPCust
(
@ID VARCHAR(50),
@Passwd VARCHAR(20),
)
AS
INSERT INTO Customers
VALUES(@ID, @Passwd)