By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,456 Members | 1,372 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,456 IT Pros & Developers. It's quick & easy.

editing tables

P: n/a
Why doesn't this code work?

DataSet MyDS ;
DataRow[] dr = null ;

OleDbConnection cn = new OleDbConnection ( Constants.ConnectionString
);
OleDbDataAdapter da = new OleDbDataAdapter(qry, cn);
cn.Open();
da.Fill(MyDS);
cn.Close() ;

dr = MyDS.Tables[0].Select() ;
int idx = 61 ;
try
{
dr[idx].ItemArray[MyDS.Tables[0].Columns.IndexOf( "XYZ" )] = "*" ;
}
catch(Exception ex)
{
int kkk=0 ; // breakpoint here
}

string st1, st2 ;
st1 = dr[idx].ItemArray[MyDS.Tables[0].Columns.IndexOf( "XYZ"
)].ToString().Trim() ;
dr[idx].AcceptChanges() ;
st2 = dr[idx].ItemArray[MyDS.Tables[0].Columns.IndexOf( "XYZ"
)].ToString().Trim() ;
// breakpoint here
int lll = 0;
The exception is not taken and afterwards, st1 and st2 are both blank.

I.e. How do I change the value of a row/column in a table?

Thanks,
Jochen


*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 16 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.