示例#1
0
        public DBresponse fillAdapter(string storedProcedure, SqlParameter[] param)
        {
            DBresponse response = new DBresponse();
            DataTable  tbl      = new DataTable();

            try
            {
                for (int index = 0; index <= param.Length - 1; index++)
                {
                    command.Parameters.Add(param[index]);
                }

                command.CommandText = storedProcedure;
                command.CommandType = CommandType.StoredProcedure;
                adapter.Fill(tbl);
                tbl.TableName  = "dd";
                response.table = fixDatatableType(tbl);
            }
            catch (Exception ex)
            {
                response.isValid   = false;
                response.exception = ex.Message;
            }
            finally
            {
                command.Parameters.Clear();
            }
            return(response);
        }
示例#2
0
        public DBresponse fillAdapter(string sql)
        {
            DBresponse response  = new DBresponse();
            DataTable  temptable = new DataTable();

            try
            {
                command.CommandText = sql;
                adapter.Fill(temptable);
                temptable.TableName = "dd";
                response.table      = fixDatatableType(temptable);
            }
            catch (Exception ex)
            {
                response.isValid   = false;
                response.exception = ex.Message;
            }

            return(response);
        }