zoukankan      html  css  js  c++  java
  • c# 读取数据库得到字符串

     public string GetProductType(string connectionString, string barCode)
            {
                string productType;
                SqlConnection conn = new SqlConnection(connectionString);
                conn.Open();
                //MessageBox.Show("连接成功");
                string sqlCmd = "select 产品型号 from ProName where 壳体编号 = '"+ barCode + "'";

                SqlCommand command = new SqlCommand(sqlCmd, conn);
                SqlDataReader read = command.ExecuteReader();
                if (read.Read())
                {
                    productType = read["产品型号"].ToString();
                    conn.Close();
                    return productType;
                }

    }

  • 相关阅读:
    [转载]我的WafBypass之道(Misc篇)
    7.3 使用while 循环来处理列表和字典
    7-4__7-7练习
    7.2 while 循环
    第 7 章 用户输入和while 循环
    6.字典练习
    6.4 嵌套
    6.3 遍历字典
    6.2练习
    第 6 章 字典
  • 原文地址:https://www.cnblogs.com/hanjiaxu/p/3200436.html
Copyright © 2011-2022 走看看