C# 使用Stored precedure
DataTable dt = new DataTable(); string connKey = 連線字串; SqlConnection sqlcon = new SqlConnection(connKey ); string spName =S.P的名稱; SqlCommand cmd = new SqlCommand(spName ); cmd.Parameters.Clear(); cmd.CommandType = CommandType.StoredProcedure; // 有外部參數使用>> cmd.Parameters.AddWithValue("@SP中外部參數名稱", 該參數的值); cmd.Parameters.AddWithValue("@para", paraValue); SqlDataAdapter da = new SqlDataAdapter(cmd); da.Fill(dt);//放到TABLE http://stackoverflow.com/questions/13402003/how-to-populate-a-datatable-from-a-stored-procedure