怎样调用存储过程~~~
CREATE PROCEDURE [insertASlogin]
(@userID_1 [int],
@username_2 [char](15),
@userpwd_3 [char](15),
@xingming_4 [varchar](20),
@tongxin_5 [varchar](200),
@youzheng_6 [char](6),
@dianhua_7 [char](12),
@Email_8 [varchar](30))
AS INSERT INTO [NetBook].[dbo].[login]
( [userID],
[username],
[userpwd],
[xingming],
[tongxin],
[youzheng],
[dianhua],
[Email])
VALUES
( @userID_1,
@username_2,
@userpwd_3,
@xingming_4,
@tongxin_5,
@youzheng_6,
@dianhua_7,
@Email_8)
GO
这是我写在SQL里面的存储过程~~~请问我想注册一个帐号要怎么调用?
就是单击注册按钮后~~~不调用存储过程我知道用~~~~各位帮个忙!!!
谢谢了~~~~~~
------解决方案--------------------SqlConnection connection = new SqlConnection(连接字符串);
SqlCommand salesCommand = new SqlCommand( "insertASlogin ",
connection);
salesCommand.CommandType = CommandType.StoredProcedure;
SqlParameter parameter = salesCommand.Parameters.Add(
"@userID_1 ", SqlDbType.Int);
parameter.Value = "1 ";
SqlParameter parameter = salesCommand.Parameters.Add(
"@username_2 ", SqlDbType.Char);
parameter.Value = "aa ";
....
connection.Open();
salesCommand.ExecuteScalar();
connection.Close();
楼主去MSDN上找资料看看
------解决方案--------------------和正常的sql一样啊.
比如sqlstring= "存储过程名 ' " + 参数 + " ' ";
然后getdataset(sqlstring);咯
getdataset是自己写个得到dataset的函数