当前位置:首页
开发技术指南» 文章正文
    引言:

    摘要: 在相同硬件环境下 是asp+access的速度快还是php+mysql的速度快呢。 谢谢指教 ......
    摘要: 我想升级一下,不知道该怎么弄。 pmmx 266 64m edo内存 3.4ghdd 现在装的是win me 速度还行,,不过如果换2k 估计就慢了,,有熟悉的吗?谢谢 ......


求一段代码,执行存储过程

求一段代码,执行存储过程,类似于  
  public   DataSet   GetDataSet(string   selectCmd)   //   Select   From   Table  
  {  
  DataSet   ds   =   null;  
  SqlConnection   m_SqlConnection   =   new   SqlConnection(m_dbConnection);  
  SqlDataAdapter   m_SqlDataAdapter   =   new   SqlDataAdapter(selectCmd,m_SqlConnection);  
  try    
  {  
  ds   =   new   DataSet();  
  m_SqlDataAdapter.Fill(ds,"Table0");  
  }   //   end   try  
  catch   (Exception   e)  
  {  
  throw   new   Exception("Error   in   CCPUCode:GetDataSet()->   "   +   e.ToString());  
  }  
  finally  
  {    
  m_SqlDataAdapter.Dispose();  
  m_SqlConnection.Close();  
  m_SqlConnection.Dispose();  
  }  
  return   ds;    
  }   //   end   GetDataSet  
  要能输入参数的那种

NO.1   作者: lr2651

public   DataSet   GetDataSet(string   selectCmd)   //   Select   From   Table  
  {  
  DataSet   ds   =   null;  
  SqlConnection   m_SqlConnection   =   new   SqlConnection(m_dbConnection);  
                                  SqlDataAdapter   m_SqlDataAdapter   =   new   SqlDataAdapter();  
  m_SqlDataAdapter.SelectCommand.CommandType   =   System.Data.CommandType.StoredProcedure;  
  m_SqlDataAdapter.SelectCommand.CommandText   =   "存储过程名";  
  m_SqlDataAdapter.SelectCommand.Connection   =   m_SqlConnection;  
  try    
  {  
  ds   =   new   DataSet();  
  m_SqlDataAdapter.Fill(ds,"Table0");  
  }   //   end   try  
  catch   (Exception   e)  
  {  
  throw   new   Exception("Error   in   CCPUCode:GetDataSet()->   "   +   e.ToString());  
  }  
  finally  
  {    
  m_SqlDataAdapter.Dispose();  
  m_SqlConnection.Close();  
  m_SqlConnection.Dispose();  
  }  
  return   ds;    
  }   //   end   GetDataSet

NO.2   作者: lr2651

public   DataSet   GetDataSet(string   存储过程名)   //   Select   From   Table  
  {  
  DataSet   ds   =   null;  
  SqlConnection   m_SqlConnection   =   new   SqlConnection(m_dbConnection);  
                                  SqlDataAdapter   m_SqlDataAdapter   =   new   SqlDataAdapter();  
  m_SqlDataAdapter.SelectCommand.CommandType   =   System.Data.CommandType.StoredProcedure;  
  m_SqlDataAdapter.SelectCommand.CommandText   =   "存储过程名";  
  m_SqlDataAdapter.SelectCommand.Connection   =   m_SqlConnection;  
  try    
  {  
  ds   =   new   DataSet();  
  m_SqlDataAdapter.Fill(ds,"Table0");  
  }   //   end   try  
  catch   (Exception   e)  
  {  
  throw   new   Exception("Error   in   CCPUCode:GetDataSet()->   "   +   e.ToString());  
  }  
  finally  
  {    
  m_SqlDataAdapter.Dispose();  
  m_SqlConnection.Close();  
  m_SqlConnection.Dispose();  
  }  
  return   ds;    
  }   //   end   GetDataSet

NO.3   作者: sunnystar365

新增  
  public   bool   InsertComInfo(int   userid,int   classid,string   company,string   phone,string   fax,string   contact,string   handset,string   address,  
  string   zipcode,string   email,string   homepage,string   imageurl)  
  {  
  SqlCommand   cmd=new   SqlCommand("INSERTCOM_INFO",con);  
  cmd.CommandType=CommandType.StoredProcedure;  
   
  SqlParameter   parID=new   SqlParameter("@userid",SqlDbType.Int);  
  parID.Value=userid;  
   
  SqlParameter   parClassID=new   SqlParameter("@classid",SqlDbType.Int);  
  parClassID.Value=classid;  
   
  SqlParameter   parCompany=new   SqlParameter("@company",SqlDbType.VarChar,30);  
  parCompany.Value=company;  
   
  SqlParameter   parPhone=new   SqlParameter("@phone",SqlDbType.VarChar,20);  
  parPhone.Value=phone;  
   
  SqlParameter   parFax=new   SqlParameter("@fax",SqlDbType.VarChar,20);  
  parFax.Value=fax;  
   
  SqlParameter   parContact=new   SqlParameter("@contact",SqlDbType.VarChar,30);  
  parContact.Value=contact;  
   
  SqlParameter   parHandSet=new   SqlParameter("@handset",SqlDbType.VarChar,20);  
  parHandSet.Value=handset;  
   
  SqlParameter   parAddress=new   SqlParameter("@address",SqlDbType.VarChar,50);  
  parAddress.Value=address;  
   
  SqlParameter   parZipCode=new   SqlParameter("@zipcode",SqlDbType.VarChar,10);  
  parZipCode.Value=zipcode;  
   
  SqlParameter   parEmail=new   SqlParameter("@email",SqlDbType.VarChar,30);  
  parEmail.Value=email;  
   
  SqlParameter   parHomePage=new   SqlParameter("@homepage",SqlDbType.VarChar,30);  
  parHomePage.Value=homepage;  
   
  SqlParameter   parImageUrl=new   SqlParameter("@imageurl",SqlDbType.VarChar,70);  
  parImageUrl.Value=imageurl;  
   
  cmd.Parameters.Add(parID);  
  cmd.Parameters.Add(parClassID);  
  cmd.Parameters.Add(parCompany);  
  cmd.Parameters.Add(parPhone);  
  cmd.Parameters.Add(parFax);  
  cmd.Parameters.Add(parContact);  
  cmd.Parameters.Add(parHandSet);  
  cmd.Parameters.Add(parAddress);  
  cmd.Parameters.Add(parZipCode);  
  cmd.Parameters.Add(parEmail);  
  cmd.Parameters.Add(parHomePage);  
  cmd.Parameters.Add(parImageUrl);  
  con.Open();  
  int   result=cmd.ExecuteNonQuery();  
  con.Close();  
  if(result>0)  
  {  
  return   true;  
  }  
  else  
  {  
  return   false;  
  }  
  }

NO.4   作者: sunnystar365

返回DataSet  
  public   DataSet   GetComInfoByID(int   classid)  
  {  
  SqlCommand   cmd=new   SqlCommand("COM_INFOBYID",con);  
  cmd.CommandType=CommandType.StoredProcedure;  
   
  SqlParameter   parClassID=new   SqlParameter("@classid",SqlDbType.Int);  
  parClassID.Value=classid;  
  cmd.Parameters.Add(parClassID);  
   
  cmdAdp.SelectCommand=cmd;  
  DataSet   ds=new   DataSet();  
  con.Open();  
  cmdAdp.Fill(ds);  
  con.Close();  
  return   ds;  
  }

NO.5   作者: sunnystar365

我上面的连接字符串没有写  
  private   string   conStr;  
  private   SqlConnection   con;  
  private   SqlDataAdapter   cmdAdp;  
  public   ComInfo()  
  {  
  //  
  //   TODO:   在此处添加构造函数逻辑  
  //  
  conStr=System.Configuration.ConfigurationSettings.AppSettings["conn"].ToString();  
  con=new   SqlConnection(conStr);  
  cmdAdp=new   SqlDataAdapter();  
  }


 ·webbrower控件的问题    »显示摘要«
    摘要: 请问各位: 如何获取webbrower网页中的url 再用第二个from 窗体打开~! ......
» 本期热门文章:
· 热门栏目:
» 相关精选文章
» 其它相关:

©2000-2007 All Rights Reserved. 最佳浏览:1024X768 MSIE