Click here to Skip to main content
15,565,403 members
Home / Discussions / C#
   

C#

 
AnswerRe: Interview question - oops Pin
Christian Graus17-Apr-07 21:36
mveChristian Graus17-Apr-07 21:36 
GeneralRe: Interview question - oops Pin
yaminilatha17-Apr-07 22:09
yaminilatha17-Apr-07 22:09 
AnswerRe: Interview question - oops Pin
sujithkumarsl17-Apr-07 23:58
sujithkumarsl17-Apr-07 23:58 
QuestionInvoke/Thread Error Pin
Rabbit1717-Apr-07 21:11
Rabbit1717-Apr-07 21:11 
AnswerRe: Invoke/Thread Error Pin
mdv11321-Apr-07 11:05
mdv11321-Apr-07 11:05 
Questionediting access table fields using C# Pin
rkherath17-Apr-07 20:55
rkherath17-Apr-07 20:55 
AnswerRe: editing access table fields using C# Pin
rah_sin17-Apr-07 21:17
professionalrah_sin17-Apr-07 21:17 
GeneralRe: editing access table fields using C# Pin
rkherath17-Apr-07 21:34
rkherath17-Apr-07 21:34 
Hi,

yes i did just now. it works. but i have 36 fields to update.

OleDbCommand upcom = new OleDbCommand();
upcom.CommandText = "UPDATE CON_AKU SET BGT_JUN" + dr["BGT_JUN"];
upcom.Connection = OLEDBcon;
upcom.ExecuteNonQuery();

so i wanna know if i can set the value in the data table row by row and update the entire row at once. please let me know if there is a way. also i found a nother way from a site. but even that doesn't work out.



this is the coding


void oledbConnection(string path,string CONstr)
{

OleDbTransaction trans;
OleDbCommand OLEDBSelectCom = new OleDbCommand();
OleDbCommand OLEDBupdateCom = new OleDbCommand();
OleDbConnection OLEDBcon = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=|DataDirectory|\\WmsFoodCityPerforman"+
"ce.mdb;Jet OLEDB:Database Password=sanuja");
OLEDBcon.Open();
trans = OLEDBcon.BeginTransaction();
OleDbDataAdapter OLEDBda = new OleDbDataAdapter();
OLEDBSelectCom.Transaction = trans;

OLEDBSelectCom.CommandText = "Select * from CON_" + CONstr;
OLEDBupdateCom.Connection = OLEDBcon;
OLEDBSelectCom.Connection = OLEDBcon;
DataSet ds = new DataSet();
OLEDBda.SelectCommand = OLEDBSelectCom;
OLEDBda.UpdateCommand = OLEDBupdateCom;

OLEDBda.Fill(ds);
DataTable dt = new DataTable();
dt = ds.Tables[0];

foreach (DataRow dr in dt.Rows)
{
//OLEDBupdateCom.CommandText = "update CON_" + CONstr + " set NET_APR=0.0";
dr["BGT_APR"] = 0;
dr["BGT_JUN"] = 0;
dr["BGT_JUL"] = 0;
dr["BGT_AUG"] = 0;
dr["BGT_SEP"] = 0;
dr["BGT_OCT"] = 0;
dr["BGT_NOV"] = 0;
dr["BGT_DEC"] = 0;
dr["BGT_JAN"] = 0;
dr["BGT_FEB"] = 0;
dr["BGT_MAR"] = 0;
dr["BUDGETED"] = 0;
dr["BUDGET_PES"] = 0;
dr["LYNET_APR"] = dr["NET_APR"];
dr["LYNET_JUN"] = dr["NET_JUN"];
dr["LYNET_JUL"] = dr["NET_JUL"];
dr["LYNET_AUG"] = dr["NET_AUG"];
dr["LYNET_SEP"] = dr["NET_SEP"];
dr["LYNET_OCT"] = dr["NET_OCT"];
dr["LYNET_NOV"] = dr["NET_NOV"];
dr["LYNET_DEC"] = dr["NET_DEC"];
dr["LYNET_JAN"] = dr["NET_JAN"];
dr["LYNET_FEB"] = dr["NET_FEB"];
dr["LYNET_MAR"] = dr["NET_MAR"];
dr["NET_APR"] = 0;
dr["NET_JUN"] = 0;
dr["NET_JUL"] = 0;
dr["NET_AUG"] = 0;
dr["NET_SEP"] = 0;
dr["NET_OCT"] = 0;
dr["NET_NOV"] = 0;
dr["NET_DEC"] = 0;
dr["NET_JAN"] = 0;
dr["NET_FEB"] = 0;
dr["NET_MAR"] = 0;
dr["LYADJ_APR"] = dr["ADJ_APR"];
dr["LYADJ_JUN"] = dr["ADJ_JUN"];
dr["LYADJ_JUL"] = dr["ADJ_JUL"];
dr["LYADJ_AUG"] = dr["ADJ_AUG"];
dr["LYADJ_SEP"] = dr["ADJ_SEP"];
dr["LYADJ_OCT"] = dr["ADJ_OCT"];
dr["LYADJ_NOV"] = dr["ADJ_NOV"];
dr["LYADJ_DEC"] = dr["ADJ_DEC"];
dr["LYADJ_JAN"] = dr["ADJ_JAN"];
dr["LYADJ_FEB"] = dr["ADJ_FEB"];
dr["LYADJ_MAR"] = dr["ADJ_MAR"];
dr["LYADJ_APR"] = 0;
dr["LYADJ_JUN"] = 0;
dr["LYADJ_JUL"] = 0;
dr["LYADJ_AUG"] = 0;
dr["LYADJ_SEP"] = 0;
dr["LYADJ_OCT"] = 0;
dr["LYADJ_NOV"] = 0;
dr["LYADJ_DEC"] = 0;
dr["LYADJ_JAN"] = 0;
dr["LYADJ_FEB"] = 0;
dr["LYADJ_MAR"] = 0;


dr.AcceptChanges();

//OLEDBupdateCom.ExecuteNonQuery();

}
dt.AcceptChanges();
OLEDBda.Update(ds);
trans.Commit();
// dataGridView1.DataSource = ds.Tables[0];
OLEDBcon.Close();





//ds.GetChanges();

//OLEDBupdateCom.CommandText="update CON_"+CONstr+" set
}


rkherath
QuestionDesposing Form problem Pin
EEmaan17-Apr-07 19:28
EEmaan17-Apr-07 19:28 
AnswerRe: Desposing Form problem Pin
Christian Graus17-Apr-07 20:40
mveChristian Graus17-Apr-07 20:40 
GeneralRe: Desposing Form problem Pin
EEmaan17-Apr-07 20:49
EEmaan17-Apr-07 20:49 
GeneralRe: Desposing Form problem Pin
Martin#17-Apr-07 21:07
Martin#17-Apr-07 21:07 
GeneralRe: Desposing Form problem Pin
EEmaan17-Apr-07 21:13
EEmaan17-Apr-07 21:13 
GeneralRe: Desposing Form problem Pin
Martin#17-Apr-07 21:22
Martin#17-Apr-07 21:22 
GeneralRe: Desposing Form problem Pin
Christian Graus17-Apr-07 21:38
mveChristian Graus17-Apr-07 21:38 
GeneralRe: Desposing Form problem Pin
Martin#17-Apr-07 21:43
Martin#17-Apr-07 21:43 
QuestionSplitting a path... Pin
deridder14917-Apr-07 18:28
deridder14917-Apr-07 18:28 
AnswerRe: Splitting a path... Pin
rah_sin17-Apr-07 18:53
professionalrah_sin17-Apr-07 18:53 
GeneralRe: Splitting a path... [modified] Pin
Mark Greenwood17-Apr-07 18:57
Mark Greenwood17-Apr-07 18:57 
GeneralRe: Splitting a path... Pin
Christian Graus17-Apr-07 20:30
mveChristian Graus17-Apr-07 20:30 
AnswerRe: Splitting a path... Pin
AB777117-Apr-07 19:20
AB777117-Apr-07 19:20 
QuestionAdd a Form to TabControl Pin
Dothanhnam17-Apr-07 17:24
Dothanhnam17-Apr-07 17:24 
AnswerRe: Add a Form to TabControl Pin
lchild38517-Apr-07 17:39
lchild38517-Apr-07 17:39 
GeneralRe: Add a Form to TabControl [modified] Pin
Dothanhnam17-Apr-07 18:12
Dothanhnam17-Apr-07 18:12 
AnswerRe: Add a Form to TabControl Pin
Martin#17-Apr-07 21:14
Martin#17-Apr-07 21:14 

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.