我想我在我的類中缺少'USING'語句,因爲當我嘗試將commandType設置爲存儲過程時出現錯誤。的CommandType = '智能感知無法找到' CommandType.StoredProcedure(注:該功能僅在部分粗加工)在此先感謝使用存儲過程和ADO.NET更新數據庫
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Configuration;
using System.Data.SqlClient;
namespace LegacyForms.Personal
{
public partial class FormBuilder : System.Web.UI.Page
{
protected void btnSubmit_Click(object sender, EventArgs e)
{
//Get the DB connection:
string ConnString = ConfigurationManager.AppSettings["AssociatedBank2011ConnectionString"];
SqlConnection conn = new SqlConnection(ConnString);
SqlCommand cmd = new SqlCommand("uspInsertPersonalAccountApplcation", conn);
cmd.Commandtype = **get error here!**
cmd.Parameters.AddWithValue("@AccountType", AcctType);
cmd.Parameters.AddWithValue("@AccountSubType", AcctSubType);
cmd.Parameters.AddWithValue("@CheckingOption", CheckOption);
conn.Open();
cmd.ExecuteNonQuery();
conn.Close();
}
}
}
謝謝.....完美!!!! – Susan 2012-02-24 16:18:52