using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.OleDb;
using System.Data.SqlClient;public partial class _Default : System.Web.UI.Page 
{
    protected void Page_Load(object sender, EventArgs e)
    {    }
    protected void Button1_Click(object sender, EventArgs e)
    {     SqlConnection conn=new SqlConnection("server=AAA-5ffb53b4342;database=Pay;uid=test;pwd=aaa");
     SqlDataAdapter da = new SqlDataAdapter();     da.SelectCommand = new SqlCommand();
     da.SelectCommand.Connection = conn;
     da.SelectCommand.CommandText = "Temp_080708_Pay_InterfacePay_CreateItem(account,account,1,orderid,ip,100,0.00)";
     da.SelectCommand.CommandType = CommandType.StoredProcedure;
       }
}我这么写,存储过程没有执行呀,也不报错,请高手看看什么问题.

解决方案 »

  1.   

    SqlCommand cmd= new SqlCommand(); 
        cmd.Connection = conn; 
    conn.Open();
        cmd.CommandText = "Temp_080708_Pay_InterfacePay_CreateItem(account,account,1,orderid,ip,100,0.00)"; 
        cmd.CommandType = CommandType.StoredProcedure; 
    cmd.ExecuteNonQuery();
      

  2.   


    SqlConnection conn = new SqlConnection("server=AAA-5ffb53b4342;database=Pay;uid=test;pwd=aaa");
    try
    {
    conn.Open();
    SqlCommand cmd = new SqlCommand();
    cmd.Connection = conn;
    cmd.CommandType = CommandType.StoredProcedure;
    cmd.CommandText = "Temp_080708_Pay_InterfacePay_CreateItem(account,account,1,orderid,ip,100,0.00)";
    cmd.ExecuteNonQuery();
    }
    catch(SqlException ex)
    {
    Response.Write(ex.Message);
    }
    finally
    {
    conn.Close();
    }
      

  3.   

    代码:using System;
    using System.Data;
    using System.Configuration;
    using System.Web;
    using System.Web.Security;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    using System.Web.UI.WebControls.WebParts;
    using System.Web.UI.HtmlControls;
    using System.Data.OleDb;
    using System.Data.SqlClient;public partial class _Default : System.Web.UI.Page 
    {
        protected void Page_Load(object sender, EventArgs e)
        {    }
        protected void Button1_Click(object sender, EventArgs e)
        {   SqlConnection conn = new SqlConnection("server=AAA-5ffb53b4342;database=Pay;uid=test;pwd=aaa");
    try
    {
        conn.Open();
        SqlCommand cmd = new SqlCommand();
        cmd.Connection = conn;
        cmd.CommandType = CommandType.StoredProcedure;
        cmd.CommandText = "Temp_080708_Pay_InterfacePay_CreateItem(account,account,1,orderid,ip,100,0.00)";
        cmd.ExecuteNonQuery();
    }
    catch(SqlException ex)
    {
        Response.Write(ex.Message);
    }
    finally
    {
        conn.Close();
    }
        }
    }运行提示:  找不到存储过程 'Temp_080708_Pay_InterfacePay_CreateItem(account,account,1,orderid,ip,100,0.00)'。 
    是怎么回事呀?
      

  4.   

    CommandText 里面直接写存储过程名字,在下面单独传参!
      

  5.   

    sqlConnection对象没有打开链接;
    SqlCommand对象没有执行;