[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.sqlserver.programming

sql commands don't update tables

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)

3 Answers

ML

3/28/2007 5:16:00 PM

0

This may sound silly, but are you connecting to the same database both times?


ML

---
http://milambda.blo...

yshie

3/29/2007 9:25:00 AM

0

yah! but i noticed something in my Server Explorer. at first, the database is
connected. but when i run my application. it becomes an X mark. what does
that mean? does it mean disconnected? or it's normal?

--
Message posted via SQLMonster.com
http://www.sqlmonster.com/Uwe/Forums.aspx/sql-server-programmin...

ML

3/29/2007 9:38:00 AM

0

What Server Explorer? What query editor are you using?


ML

---
http://milambda.blo...