Click here to Skip to main content
15,914,225 members
Home / Discussions / Database
   

Database

 
QuestionJDBC + MySQL Pin
NightFox50021-Dec-06 20:42
NightFox50021-Dec-06 20:42 
AnswerRe: JDBC + MySQL Pin
Colin Angus Mackay21-Dec-06 23:11
Colin Angus Mackay21-Dec-06 23:11 
AnswerRe: JDBC + MySQL Pin
Pete O'Hanlon22-Dec-06 2:00
mvePete O'Hanlon22-Dec-06 2:00 
QuestionCopying column with OLE Object datatype? Pin
kbalias21-Dec-06 18:36
kbalias21-Dec-06 18:36 
AnswerRe: Copying column with OLE Object datatype? Pin
Colin Angus Mackay21-Dec-06 23:10
Colin Angus Mackay21-Dec-06 23:10 
QuestionConnection Issue While connecting to SqlServer 2000 from ASP.NET 2.0 Pin
nesaraja21-Dec-06 18:29
nesaraja21-Dec-06 18:29 
AnswerRe: Connection Issue While connecting to SqlServer 2000 from ASP.NET 2.0 Pin
Colin Angus Mackay21-Dec-06 23:08
Colin Angus Mackay21-Dec-06 23:08 
QuestionDeleted row outside program problem. Pin
Tomy140221-Dec-06 15:43
Tomy140221-Dec-06 15:43 
I have trouble with deleted row in my database program. When my program starts, I start another program too (MySQLBrowser) and from MySQLBrowser, I delete one row. After that in my Program, I refresh (re-fill) my relevant DataTable but the deleted row still exist in DataTable.

I found out a solution by clearing DataTable first, then re-fill it again. It Works.

Clearing DataTable really works. But, what if there are thousands rows?

Anywayay, here's the code:
I have a Static Class which holds the only DataSet in my program. All DataTables created are stored in that DataSet.

/*******************************************************************/
public static DataSet dsObj = new DataSet(); //the one and only DataSet in my program
public static MySqlConnection connObj = new MySqlConnection(connStr);

//method to add Table or Tables to DataSet
public static void addTblsToDsObj(String tblName)
{
String[] tblArr = tblName.Split(',');

dsObj.EnforceConstraints = false; //I remove constrain before clearing DataTable, because of ForeignKey problem

for (int i = 0; i < tblArr.Length; i++ )
{
if(dsObj.Tables.Contains(tblArr[i])){ //If DataSet has same Table, I clear that table before fill it again

dsObj.Tables[tblArr[i]].Clear();
}
}

dsObj.EnforceConstraints = true; //after needed tables are cleared, I set it to true because I want to load the primary key too.

for (int i = 0; i < tblArr.Length; i++)
{
MySqlDataAdapter daObj = new MySqlDataAdapter("SELECT * FROM " + tblArr[i], connObj);
MySqlCommandBuilder cbObj = new MySqlCommandBuilder(daObj);
daObj.MissingSchemaAction = MissingSchemaAction.AddWithKey;
daObj.Fill(dsObj, tblArr[i]);
}
}
/*******************************************************************/

Now, everytime my Form load a Table from MySQL, I call method addTblsToDsObj(String tblName).

Note that code above works fine with deleted data outside my Program environtment (because if Clear method).

I repeat my question above, what if I have thousand of rows? it means I will clear a lot of unnecessary rows right? so I guess it's not an optimal performance.

Thx for any help.
AnswerRe: Deleted row outside program problem. Pin
Frank Kerrigan21-Dec-06 23:43
Frank Kerrigan21-Dec-06 23:43 
GeneralRe: Deleted row outside program problem. Pin
Tomy140222-Dec-06 15:21
Tomy140222-Dec-06 15:21 
QuestionHow do you quote parameters for an Oracle Select statement string when the parameter contains a quote? Pin
howardjr21-Dec-06 12:43
howardjr21-Dec-06 12:43 
AnswerRe: How do you quote parameters for an Oracle Select statement string when the parameter contains a quote? Pin
Colin Angus Mackay21-Dec-06 13:24
Colin Angus Mackay21-Dec-06 13:24 
GeneralRe: How do you quote parameters for an Oracle Select statement string when the parameter contains a quote? Pin
howardjr21-Dec-06 16:49
howardjr21-Dec-06 16:49 
GeneralRe: How do you quote parameters for an Oracle Select statement string when the parameter contains a quote? Pin
Mairaaj Khan21-Dec-06 21:17
professionalMairaaj Khan21-Dec-06 21:17 
GeneralRe: How do you quote parameters for an Oracle Select statement string when the parameter contains a quote? Pin
Colin Angus Mackay21-Dec-06 23:05
Colin Angus Mackay21-Dec-06 23:05 
GeneralRe: How do you quote parameters for an Oracle Select statement string when the parameter contains a quote? Pin
howardjr22-Dec-06 6:56
howardjr22-Dec-06 6:56 
GeneralRe: How do you quote parameters for an Oracle Select statement string when the parameter contains a quote? Pin
Colin Angus Mackay22-Dec-06 7:00
Colin Angus Mackay22-Dec-06 7:00 
GeneralRe: How do you quote parameters for an Oracle Select statement string when the parameter contains a quote? Pin
Paul Conrad22-Dec-06 7:24
professionalPaul Conrad22-Dec-06 7:24 
GeneralRe: How do you quote parameters for an Oracle Select statement string when the parameter contains a quote? Pin
Colin Angus Mackay22-Dec-06 8:03
Colin Angus Mackay22-Dec-06 8:03 
GeneralRe: How do you quote parameters for an Oracle Select statement string when the parameter contains a quote? Pin
howardjr23-Dec-06 19:43
howardjr23-Dec-06 19:43 
QuestionHow to trim fields on the table Sql Server 2000 ? Pin
kindman_nb21-Dec-06 11:34
kindman_nb21-Dec-06 11:34 
AnswerRe: How to trim fields on the table Sql Server 2000 ? Pin
Colin Angus Mackay21-Dec-06 13:26
Colin Angus Mackay21-Dec-06 13:26 
GeneralRe: How to trim fields on the table Sql Server 2000 ? Pin
kindman_nb22-Dec-06 10:19
kindman_nb22-Dec-06 10:19 
AnswerRe: How to trim fields on the table Sql Server 2000 ? Pin
Frank Kerrigan21-Dec-06 23:46
Frank Kerrigan21-Dec-06 23:46 
GeneralRe: How to trim fields on the table Sql Server 2000 ? Pin
kindman_nb22-Dec-06 0:13
kindman_nb22-Dec-06 0:13 

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.