• λ我爱Aspx >> C#.Net >> mysql存储过程及c#调用标准版_数据库技巧
  • mysql存储过程及c#调用标准版_数据库技巧

  • :aspxer  Դ:internet  :2007-4-28 23:44:35  ؼ:c#,sql,数据库,数据
  • private string shuju_lianjie(string name, string email, string password)

    {

    //////////////////////////////////////////////////////////////////////////////

    ///获取用户名、邮件及设定密码,增加到数据库的用户表后返回该用户注册id值,不考虑 安全,仅仅表示代码的写作范例是否合乎要求

    ///存储过程为:

    ///CREATE PROCEDURE `yuan_user_cc`(in xname varchar(100),in xemail varchar(100),in xpassword varchar(100),out xid integer)

    ///begin

    ///insert into yuan_user(name,email,password) values(xname,xemail,xpassword);

    ///select id into xid from yuan_user where name=xname;

    ///end

    //////////////////////////////////////////////////////////////////////////////

    Int16 id;//返回的id值

    MySqlConnection mysqlcon;

    MySqlDataAdapter mysqldata = new MySqlDataAdapter();

    DataSet dataset = new DataSet();

    mysqlcon = new MySqlConnection("server=localhost; user id=root; password=123; database=yuan_test; pooling=false;charset=gb2312");

    mysqldata.SelectCommand = new MySqlCommand();

    mysqldata.SelectCommand.Connection = mysqlcon;

    mysqldata.SelectCommand.CommandText = "yuan_user_cc";

    mysqldata.SelectCommand.CommandType = CommandType.StoredProcedure;

    //设置参数,添加到数据库

    MySqlParameter name_parameter = new MySqlParameter("?xname", MySqlDbType.VarChar,100);//mysql的存储过程参数是以?打头的!!!!

    name_parameter.Value = name;

    mysqldata.SelectCommand.Parameters.Add(name_parameter);

    //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

    Ҷƪл˵?
  • һƪSQLServer分页查询通用存储过程_数据库技巧
    һƪMysql分页查询通用存储过程_数据库技巧