惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

宝玉的分享
宝玉的分享
NISL@THU
NISL@THU
E
Exploit-DB.com RSS Feed
L
LINUX DO - 热门话题
L
Lohrmann on Cybersecurity
K
Kaspersky official blog
Project Zero
Project Zero
Cisco Talos Blog
Cisco Talos Blog
T
The Exploit Database - CXSecurity.com
P
Palo Alto Networks Blog
C
CXSECURITY Database RSS Feed - CXSecurity.com
T
Threatpost
S
Schneier on Security
G
GRAHAM CLULEY
The Hacker News
The Hacker News
T
Threat Research - Cisco Blogs
Scott Helme
Scott Helme
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
P
Privacy & Cybersecurity Law Blog
C
Cyber Attacks, Cyber Crime and Cyber Security
Cyberwarzone
Cyberwarzone
C
CERT Recently Published Vulnerability Notes
T
Tor Project blog
AWS News Blog
AWS News Blog
Simon Willison's Weblog
Simon Willison's Weblog
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
爱范儿
爱范儿
P
Privacy International News Feed
云风的 BLOG
云风的 BLOG
P
Proofpoint News Feed
S
Securelist
G
Google Developers Blog
The Last Watchdog
The Last Watchdog
Google Online Security Blog
Google Online Security Blog
美团技术团队
F
Fortinet All Blogs
小众软件
小众软件
Recorded Future
Recorded Future
V
Visual Studio Blog
B
Blog RSS Feed
H
Help Net Security
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
Google DeepMind News
Google DeepMind News
Blog — PlanetScale
Blog — PlanetScale
博客园 - 聂微东
Stack Overflow Blog
Stack Overflow Blog
Martin Fowler
Martin Fowler
Latest news
Latest news
Spread Privacy
Spread Privacy
H
Heimdal Security Blog

博客园 - 狂闪工作室

Subject类 Questions类 Members类 Member类 Info类 Images类 Category类 Dlh21数据库备份 文章集萃 网站方案 网址收集 TreeView小结 仿照csdn左面的菜单的ASP+数据库无限级树菜单代码分享 树型论坛的快速算法 [原创]用ASP.NETN层结构封装的数据层访问基类 如何在DataGrid前加一个列让其id按顺序排列,而非绑定的id字段的乱七八糟的排序??? - 狂闪工作室 如何把两个并列文本框整合到一个下拉框中? 图片上传自动生成缩略图VB组件!
Products类
狂闪工作室 · 2005-09-15 · via 博客园 - 狂闪工作室

using System;
using System.Data;
using System.Data.SqlClient;
using System.Collections;

namespace Db
{
 /// <summary>
 /// Products 的摘要说明。
 /// </summary>
 public class Products
 {
  public Products()
  {
   //
   // TODO: 在此处添加构造函数逻辑
   //
  }

  private SqlConnection conn;
  private SqlCommand cmd;
  private SqlDataReader dr;

  public void add(ArrayList a)
  {
   conn = new SqlConnection(Str.con);
   cmd = new SqlCommand("Products_add",conn);
   cmd.CommandType = CommandType.StoredProcedure;

   cmd.Parameters.Add("@ProName",SqlDbType.VarChar,50).Value = a[0];
   cmd.Parameters.Add("@ProSize",SqlDbType.VarChar,50).Value = a[1];
   cmd.Parameters.Add("@ProID",SqlDbType.VarChar,50).Value = a[2];
   cmd.Parameters.Add("@Category",SqlDbType.VarChar,50).Value = a[3];
   cmd.Parameters.Add("@Img",SqlDbType.VarChar,200).Value = a[4];
   cmd.Parameters.Add("@Pic",SqlDbType.VarChar,200).Value = a[5];
   cmd.Parameters.Add("@RetailPrice",SqlDbType.VarChar,50).Value = a[6];
   cmd.Parameters.Add("@Vouch",SqlDbType.Int).Value = a[7];
   cmd.Parameters.Add("@Info",SqlDbType.Text).Value = a[8];
   cmd.Parameters.Add("@AddDate",SqlDbType.Text).Value = a[9];

   conn.Open();
   try
   {
    cmd.ExecuteNonQuery();
   }
   catch(Exception ex)
   {
    throw new Exception(ex.Message);
   }
   finally
   {
    cmd.Dispose();
    conn.Close();
   }
  }

  public SqlDataReader drAll()
  {
   conn = new SqlConnection(Str.con);
   cmd = new SqlCommand("Products_sel",conn);
   cmd.CommandType = CommandType.StoredProcedure;

   conn.Open();
   dr = cmd.ExecuteReader(CommandBehavior.CloseConnection);
   return dr;
  }
 }
}