Click here to Skip to main content
15,899,679 members
Home / Discussions / C#
   

C#

 
GeneralRe: DataGrid Cell Edit Pin
Kayess Tech6-May-05 0:34
professionalKayess Tech6-May-05 0:34 
GeneralRe: DataGrid Cell Edit Pin
Polis Pilavas6-May-05 1:15
Polis Pilavas6-May-05 1:15 
GeneralRe: DataGrid Cell Edit Pin
Kayess Tech6-May-05 1:27
professionalKayess Tech6-May-05 1:27 
GeneralRe: DataGrid Cell Edit Pin
Polis Pilavas6-May-05 1:38
Polis Pilavas6-May-05 1:38 
Generalweb service Pin
skrishnasarma5-May-05 17:57
skrishnasarma5-May-05 17:57 
GeneralRe: web service Pin
Dan_P5-May-05 18:29
Dan_P5-May-05 18:29 
GeneralRe: web service Pin
skrishnasarma5-May-05 19:46
skrishnasarma5-May-05 19:46 
GeneralADO.NET Pin
Dharma Dassanayake5-May-05 16:17
Dharma Dassanayake5-May-05 16:17 
Look at the following snippet of code. By pressing button1 invokes AddRow() method intending to add a row to the table (say Customers). When run it there won't be any erros but physically it hasn't added any row to the customers table. What's wrong with that. Anybody could suggest?

Thanks

***********************************************************************
public static void AddRow(DataTable myDataTable)
{
DataRow myNewDataRow = myDataTable.NewRow();
myNewDataRow["CustomerID"] = "T1Com";
myNewDataRow["CompanyName"]= "My Company Name";

myDataTable.Rows.Add(myNewDataRow);

myDataTable.AcceptChanges();
}

private void button2_Click(object sender, System.EventArgs e)
{
OleDbConnection conn = new OleDbConnection(@"provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Temp\orders.mdb;User ID=;Password=;");
string selectString = "SELECT CustomerID, CompanyName "+
"FROM Customers ";

OleDbCommand cmd = conn.CreateCommand();
cmd.CommandText = selectString;

OleDbDataAdapter dAdapt = new OleDbDataAdapter();

dAdapt.SelectCommand = cmd;

DataSet dSet = new DataSet();

conn.Open();

dAdapt.Fill(dSet,"Customers");

DataTable dTable = dSet.Tables["Customers"];
AddRow(dTable);

conn.Close();
}
************************************************************************



GeneralRe: ADO.NET Pin
Polis Pilavas6-May-05 0:36
Polis Pilavas6-May-05 0:36 
GeneralRe: ADO.NET Pin
Dharma Dassanayake6-May-05 19:43
Dharma Dassanayake6-May-05 19:43 
GeneralRe: ADO.NET Pin
Polis Pilavas7-May-05 1:21
Polis Pilavas7-May-05 1:21 
GeneralRe: ADO.NET Pin
Dharma Dassanayake7-May-05 15:47
Dharma Dassanayake7-May-05 15:47 
GeneralRe: ADO.NET Pin
Polis Pilavas8-May-05 1:34
Polis Pilavas8-May-05 1:34 
Generalgetting "InvalidActiveXStateException" while using "AxWebBrowser" - HELP! Pin
Green Fuze5-May-05 15:27
Green Fuze5-May-05 15:27 
GeneralAssembly Files Pin
pmasknguyen5-May-05 13:19
pmasknguyen5-May-05 13:19 
GeneralMoving controls in a form and store/restore the position Pin
youssef5-May-05 12:46
youssef5-May-05 12:46 
GeneralRe: Moving controls in a form and store/restore the position Pin
MoustafaS5-May-05 13:47
MoustafaS5-May-05 13:47 
QuestionHow to suspend drawing operation of a form ? Pin
DimaC5-May-05 12:02
DimaC5-May-05 12:02 
AnswerRe: How to suspend drawing operation of a form ? Pin
keith maddox6-May-05 2:56
keith maddox6-May-05 2:56 
GeneralRe: How to suspend drawing operation of a form ? Pin
DimaC6-May-05 3:03
DimaC6-May-05 3:03 
AnswerRe: How to suspend drawing operation of a form ? Pin
benjymous6-May-05 3:20
benjymous6-May-05 3:20 
GeneralRe: How to suspend drawing operation of a form ? Pin
DimaC6-May-05 3:31
DimaC6-May-05 3:31 
GeneralRe: How to suspend drawing operation of a form ? Pin
benjymous6-May-05 3:34
benjymous6-May-05 3:34 
GeneralRe: How to suspend drawing operation of a form ? Pin
DimaC6-May-05 3:39
DimaC6-May-05 3:39 
GeneralBinary serialization questions Pin
WujekSamoZlo5-May-05 11:09
WujekSamoZlo5-May-05 11:09 

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.