|
-
March 19th, 2011, 04:54 PM
#1
Connecting to data base in visual studio.Net
Hi guys,
I connected to database using the following code
SqlConnection cn = new SqlConnection(@"Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\DBDB.mdf;Integrated Security=True;User Instance=True");
SqlCommand cmd = cn.CreateCommand();
cmd.CommandType = CommandType.StoredProcedure;
cmd.CommandText = "StoredProcedure";
SqlParameter par = cmd.Parameters.Add("@GlobalNumberID", SqlDbType.BigInt);
par.Direction = ParameterDirection.Input;
par.Value = Convert.ToInt64(textBox1.Text);
cn.Open();
cmd.ExecuteNonQuery();
cn.Close();
Stored procedure is
ALTER PROCEDURE StoredProcedure1
(
@GNumber BigInt
)
AS
Insert into NumberTable(GNumber)
Values (@GNumber)
RETURN
there is no error but when I check the table there is no data added to it WHY?
I really give up is the problem with my bconnection or what?
Can ANY one help me
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|