Click here to Skip to main content
15,917,591 members
Home / Discussions / C#
   

C#

 
Question[Message Deleted] Pin
dataminers16-Sep-08 4:56
dataminers16-Sep-08 4:56 
RantRe: Persistent object and Transient object ? Pin
Guffa16-Sep-08 5:32
Guffa16-Sep-08 5:32 
GeneralRe: Persistent object and Transient object ? Pin
Pete O'Hanlon16-Sep-08 8:49
mvePete O'Hanlon16-Sep-08 8:49 
GeneralRe: Persistent object and Transient object ? Pin
Dave Kreskowiak16-Sep-08 8:59
mveDave Kreskowiak16-Sep-08 8:59 
JokeRe: Persistent object and Transient object ? Pin
Guffa16-Sep-08 9:37
Guffa16-Sep-08 9:37 
GeneralRe: Persistent object and Transient object ? Pin
Pete O'Hanlon16-Sep-08 9:44
mvePete O'Hanlon16-Sep-08 9:44 
GeneralRe: Persistent object and Transient object ? Pin
Muammar©16-Sep-08 13:37
Muammar©16-Sep-08 13:37 
Question{"Invalid object name 'Table."} Pin
postonoh16-Sep-08 4:50
postonoh16-Sep-08 4:50 
Having a problem. every time I try to change database and query a different table. I get this error.
{"Invalid object name 'Contact'."}
Now when i load the first database and its table every table on database works fine.
but when I change database it load ok get the error when I try to query a table from the new database.

private void DataGridFill(bool isAccess, bool isOIS)
        {
            
            string connString, stbQuery;
            DataGridView dgv;
           
            if (isAccess)
            {
                connString = AccessConnString;
                stbQuery = String.Format("SELECT * FROM {0}", cmbboxAccessTables.Text );
                dgv = dgvAccess;
            }
            else
            {
                connString = SqlConnString;
                stbQuery = String.Format("SELECT * FROM {0}", cmbboxOISTables.Text);
                dgv = dgvOIS;
            }
            // open connection
            var conn = new OleDbConnection(connString);
            conn.Open();
            
            // create query

            //var sqlQuery = new OleDbCommand(stbQuery);
            //sqlQuery.Connection = conn;
           
            // create an OLEDbDataAdapter to execute query
            var dataAdapter = new OleDbDataAdapter(stbQuery, conn);

            //create a command builder
            OleDbCommandBuilder cb = new OleDbCommandBuilder(dataAdapter);
            
            //create a DataTable to hold the query results
            var data = new DataTable();
            
             // fill data adapter
            dataAdapter.Fill(data);

            // Set it back to something that allows us to set the datasource
            // Arbitrarily picked CellSelect
            // We change it back to FullColumnSelect later
            if (dgv.SelectionMode == DataGridViewSelectionMode.FullColumnSelect)
            {
                dgv.SelectionMode = DataGridViewSelectionMode.CellSelect;
            }

            // assign datasource
            dgv.DataSource = data;

            // must format before assigning data source or else we error (selection issues)
            FormatGrid(ref dgv);


Learning to Code

AnswerRe: {"Invalid object name 'Table."} Pin
Richard Blythe16-Sep-08 5:16
Richard Blythe16-Sep-08 5:16 
GeneralRe: {"Invalid object name 'Table."} Pin
postonoh16-Sep-08 6:14
postonoh16-Sep-08 6:14 
GeneralRe: {"Invalid object name 'Table."} Pin
Richard Blythe16-Sep-08 7:15
Richard Blythe16-Sep-08 7:15 
QuestionNot Opening SQL Database file in Web applications: Pin
nkmnkmnkmnkm16-Sep-08 4:49
nkmnkmnkmnkm16-Sep-08 4:49 
Questionextracting sustrings from a string and store it in an array Pin
wajans16-Sep-08 3:56
wajans16-Sep-08 3:56 
AnswerRe: extracting sustrings from a string and store it in an array Pin
Alan Balkany16-Sep-08 4:04
Alan Balkany16-Sep-08 4:04 
AnswerRe: extracting sustrings from a string and store it in an array Pin
DaveyM6916-Sep-08 4:13
professionalDaveyM6916-Sep-08 4:13 
AnswerRe: extracting sustrings from a string and store it in an array [modified] Pin
#realJSOP16-Sep-08 4:15
professional#realJSOP16-Sep-08 4:15 
GeneralRe: extracting sustrings from a string and store it in an array Pin
wajans16-Sep-08 19:43
wajans16-Sep-08 19:43 
AnswerRe: extracting sustrings from a string and store it in an array Pin
PIEBALDconsult16-Sep-08 4:24
mvePIEBALDconsult16-Sep-08 4:24 
AnswerRe: extracting sustrings from a string and store it in an array [modified] Pin
Guffa16-Sep-08 6:12
Guffa16-Sep-08 6:12 
GeneralRe: extracting sustrings from a string and store it in an array Pin
wajans16-Sep-08 19:31
wajans16-Sep-08 19:31 
AnswerRe: extracting sustrings from a string and store it in an array Pin
wajans16-Sep-08 20:22
wajans16-Sep-08 20:22 
GeneralRe: extracting sustrings from a string and store it in an array Pin
Guffa16-Sep-08 21:45
Guffa16-Sep-08 21:45 
GeneralRe: extracting sustrings from a string and store it in an array Pin
wajans18-Sep-08 20:55
wajans18-Sep-08 20:55 
GeneralRe: extracting sustrings from a string and store it in an array Pin
Guffa18-Sep-08 22:43
Guffa18-Sep-08 22:43 
AnswerRe: extracting sustrings from a string and store it in an array [modified] Pin
wajans18-Sep-08 23:48
wajans18-Sep-08 23:48 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.