public static DataTable GetBrands(string code) { SqlConnection g_conn; SqlCommand g_cmd; DataSet g_ds = new DataSet(); SqlDataAdapter g_da = new SqlDataAdapter(); SqlParameter pRowVersion; try { using (g_conn = new SqlConnection( ConnectionStringBuild.GetConnectionString()) ) { g_da.SelectCommand = new SqlCommand(); g_da.SelectCommand.CommandType = CommandType.StoredProcedure; g_da.SelectCommand.CommandText = "TestSearchBrandsByCode"; g_da.SelectCommand.Connection = g_conn; SqlParameter pBrandCode = new SqlParameter("@PBrandCode", SqlDbType.NChar, 6) { Direction = ParameterDirection.InputOutput, Value = code }; g_da.SelectCommand.Parameters.Add(pBrandCode); g_da.SelectCommand.Parameters.Add("@PBrandID", SqlDbType.Int, -1).Direction = ParameterDirection.Output; g_da.SelectCommand.Parameters.Add("@PShortName", SqlDbType.NVarChar, 50).Direction = ParameterDirection.Output; g_da.SelectCommand.Parameters.Add("@PFullName", SqlDbType.NVarChar, 100).Direction = ParameterDirection.Output; pRowVersion = new SqlParameter("@PRowVersion", SqlDbType.VarBinary, -1) { Direction = ParameterDirection.Output, SourceVersion = DataRowVersion.Original }; g_da.SelectCommand.Parameters.Add(pRowVersion); g_da.SelectCommand.Connection.Open(); g_da.Fill(g_ds); g_da.SelectCommand.Connection.Close(); return g_ds.Tables[0]; } } catch { throw; }
}
|