zoukankan      html  css  js  c++  java
  • .net 数据库存储

       SqlConnection myConnection = new SqlConnection(ConfigurationSettings.AppSettings["ConnectionString"]);
                SqlCommand myCommand = new SqlCommand("CustomerAdd", myConnection);

                // Mark the Command as a SPROC
                myCommand.CommandType = CommandType.StoredProcedure;

                // Add Parameters to SPROC
                SqlParameter parameterFullName = new SqlParameter("@FullName", SqlDbType.NVarChar, 50);
                parameterFullName.Value = fullName;
                myCommand.Parameters.Add(parameterFullName);

                SqlParameter parameterEmail = new SqlParameter("@Email", SqlDbType.NVarChar, 50);
                parameterEmail.Value = email;
                myCommand.Parameters.Add(parameterEmail);

                SqlParameter parameterPassword = new SqlParameter("@Password", SqlDbType.NVarChar, 50);
                parameterPassword.Value = password;
                myCommand.Parameters.Add(parameterPassword);

                SqlParameter parameterCustomerID = new SqlParameter("@CustomerID", SqlDbType.Int, 4);
                parameterCustomerID.Direction = ParameterDirection.Output;
                myCommand.Parameters.Add(parameterCustomerID);

                try {
                    myConnection.Open();
                    myCommand.ExecuteNonQuery();
                    myConnection.Close();

                    // Calculate the CustomerID using Output Param from SPROC
                    int customerId = (int)parameterCustomerID.Value;

                    return customerId.ToString();
                }
                catch {
                    return String.Empty;
                }
  • 相关阅读:
    pycharm上传代码到github中
    requests的封装(user-agent,proxies)
    Flask
    CTBCMCLibUser类
    TB timer 的用法
    多个 additional include directories 的复制方法
    怎样在编译时不显示警告
    infragistics 循环每一个选中的行
    Infragitics ultra grid 实现点击某一个cell的时候选中整行,并且不可编辑
    c#转换 datetime
  • 原文地址:https://www.cnblogs.com/kevinge/p/1214544.html
Copyright © 2011-2022 走看看