zoukankan      html  css  js  c++  java
  • SqlParameter用法

    转自:http://www.cnblogs.com/morningwang/archive/2007/06/06/773198.html

    1 public static void Sql_Operation(string userID)
     2    
     3        using (SqlConnection myConncetion = new SqlConnection(ConfigurationManager.AppSettings["ConnString"]))
     4        using (SqlCommand myCommand = new SqlCommand("select UserID, UserName, UserPwd from WHERE userID = @userID ", myConncetion))
     5        {
     6            try
     7            {
     8                SqlParameter myParameter = new SqlParameter("@userID",SqlDbType.Int,4);
     9                myParameter.Value = Int32.Parse(userID);
    10                myCommand.Parameters.Add(myParameter);
    11                myConncetion.Open();
    12                myCommand.ExecuteNonQuery();
    13            }

    14            catch (Exception err)
    15            {
    16                throw new Exception("Err info:"+err.Message.ToString())
    17            }

    18            finally
    19            {
    20                myDataAdapter.Dispose();
    21                myConncetion.Close();
    22                myConncetion.Dispose();
    23            }

    24        }

    25    }

    好记性不如烂博客
  • 相关阅读:
    mini linux制作
    samba
    文件链接
    bz1234513
    shell中if判断语句
    文件系统层次结构
    ssh免密码登陆
    shell基础
    参考__Web前端大全
    参考__综合类网站大全
  • 原文地址:https://www.cnblogs.com/huazaizai/p/1788223.html
Copyright © 2011-2022 走看看