String connString = "Data Source = localhost; Initial Catalog = hkjc;User ID = sa;Pwd = 123";
SqlConnection conn = new SqlConnection(connString);
conn.Open();
SqlCommand cmd = new SqlCommand("GetManagement", conn);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.Add("@management", SqlDbType.VarChar, 50).Value = managementname;
SqlDataAdapter sda = new SqlDataAdapter(cmd);
DataTable dt=new DataTable();
sda.Fill(dt);
cmd.Dispose();
cmd.Clone();
conn.Dispose();
conn.Close();
return dt;
注:GetManagement為存儲過程名稱 @management為參數名稱