C# call SQL stored procedure
using System.Data.SqlClient;
using System.Data;
string connStr = "Data Source=(local);Initial Catalog=SinoPacDocDB;Persist Security Info=True;User ID=sa;Password=sa";
SqlConnection conn = new SqlConnection(connStr);
SqlCommand cmd = new SqlCommand("Sp_Doc_MyDoc", conn);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.AddWithValue("@Sel_PageSize", 10);
cmd.Parameters.AddWithValue("@Sel_PageIndex", 0);
cmd.Parameters.AddWithValue("@UserCode", "103190");
conn.Open();
SqlDataAdapter ad = new SqlDataAdapter(cmd);
DataSet ds = new DataSet();
ad.Fill(ds);
conn.Close();
標籤: C#
0 個意見:
張貼留言
訂閱 張貼留言 [Atom]
<< 首頁