Click here to Skip to main content
15,890,043 members
Home / Discussions / Database
   

Database

 
GeneralRe: OdbcDataAdapter OR OleDbDataAdapter Pin
David Salter14-Sep-04 10:59
David Salter14-Sep-04 10:59 
GeneralRe: OdbcDataAdapter OR OleDbDataAdapter Pin
cmk14-Sep-04 15:58
cmk14-Sep-04 15:58 
GeneralRe: OdbcDataAdapter OR OleDbDataAdapter Pin
Salil Khedkar14-Sep-04 20:19
Salil Khedkar14-Sep-04 20:19 
GeneralRe: OdbcDataAdapter OR OleDbDataAdapter Pin
Salil Khedkar14-Sep-04 22:32
Salil Khedkar14-Sep-04 22:32 
QuestionRowUpdated event,, info ???? Pin
Md Saleem Navalur13-Sep-04 2:44
Md Saleem Navalur13-Sep-04 2:44 
GeneralCDaoDatabase connect string in Windows XP Pin
olis12-Sep-04 5:34
olis12-Sep-04 5:34 
GeneralReporting Service Pin
architechnology.de11-Sep-04 5:00
architechnology.de11-Sep-04 5:00 
GeneralWhy I Can't update table (dbf) Pin
delemur11-Sep-04 3:29
delemur11-Sep-04 3:29 
Hi. (Firstly, sorry for my English)
I have a set of .dbf files (tables) in directory
I want to work with this files as database with ADO.NET
(c#)
I have no problem when reading data, but I can't change it.
For example, i have a file "test.dbf" in folder "d:\db".
The test.dbf is a table with 2 columns
- CODE (number[4])
- NAME (character[20])
The table has a one record (0,"joan")
I need to add a new record to this table (1,"alex")

Code:
<br />
string TableName		= "test";<br />
string SelectString		= "SELECT * FROM " + TableName;<br />
string DirectoryName	= @"d:\db";<br />
string ConnectString	= "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" +<br />
	DirectoryName + ";Extended Properties=dBase 5.0;";<br />
<br />
OleDbConnection myConn			= new OleDbConnection(ConnectString);<br />
OleDbDataAdapter myDataAdapter	= new OleDbDataAdapter();<br />
myDataAdapter.SelectCommand		= new OleDbCommand(SelectString, myConn);<br />
<br />
myConn.Open();<br />
<br />
DataSet ds = new DataSet();<br />
myDataAdapter.Fill(ds, TableName);<br />
<br />
DataTable t = ds.Tables[TableName];<br />
<br />
//code to modify data in DataSet here<br />
DataRow dr = t.NewRow();<br />
dr["CODE"] = "1";<br />
dr["NAME"] = "alex";<br />
t.Rows.Add(dr);<br />
<br />
myDataAdapter.Update(ds, TableName); // ERROR OCCURS HERE<br />
myConn.Close();<br />


When I run "Update" method of OleDbAdapter
error occurs.

"Update requires a valid InsertCommand when passed DataRow collection with new rows."

I asked about this problem in russian forums many times,
but nobody can answer me exactly.
I understatnd that I have to specify the InsertCommand of OleDbDataAdapter but how I have to do it I don't.

Could you answer me, what "InsertCommand" must be or (it would be better) give an examle.
Thank you.
GeneralRe: Why I Can't update table (dbf) Pin
sreejith ss nair11-Sep-04 23:50
sreejith ss nair11-Sep-04 23:50 
GeneralWriting ActiveX Controls Pin
DustinMiles10-Sep-04 11:33
DustinMiles10-Sep-04 11:33 
GeneralRe: Writing ActiveX Controls Pin
Steven Campbell10-Sep-04 18:37
Steven Campbell10-Sep-04 18:37 
QuestionIs there a performance difference? Pin
Marc Clifton10-Sep-04 8:13
mvaMarc Clifton10-Sep-04 8:13 
AnswerRe: Is there a performance difference? Pin
Grimolfr10-Sep-04 9:15
Grimolfr10-Sep-04 9:15 
AnswerRe: Is there a performance difference? Pin
je_gonzalez10-Sep-04 10:45
je_gonzalez10-Sep-04 10:45 
AnswerRe: Is there a performance difference? Pin
Steven Campbell10-Sep-04 18:33
Steven Campbell10-Sep-04 18:33 
AnswerRe: Is there a performance difference? Pin
Mike Ellison12-Sep-04 5:35
Mike Ellison12-Sep-04 5:35 
QuestionHow do I clear a datasource from a bound control? Pin
Bart-Man10-Sep-04 4:05
Bart-Man10-Sep-04 4:05 
AnswerRe: How do I clear a datasource from a bound control? Pin
sreejith ss nair11-Sep-04 23:55
sreejith ss nair11-Sep-04 23:55 
GeneraltSQL query Pin
partt10-Sep-04 2:57
partt10-Sep-04 2:57 
GeneralRe: tSQL query Pin
partt10-Sep-04 3:06
partt10-Sep-04 3:06 
GeneralGetting Server List. Pin
Sumit Domyan9-Sep-04 21:17
Sumit Domyan9-Sep-04 21:17 
GeneralRe: Getting Server List. Pin
David Salter9-Sep-04 22:39
David Salter9-Sep-04 22:39 
Generalnot detecting local MSDE Pin
Steven Dahlin9-Sep-04 17:00
Steven Dahlin9-Sep-04 17:00 
GeneralRe: not detecting local MSDE Pin
Christian Graus9-Sep-04 17:28
protectorChristian Graus9-Sep-04 17:28 
GeneralExtremely slow performance of OleDbDataAdapter.Fill method Pin
rotarinn9-Sep-04 7:05
rotarinn9-Sep-04 7:05 

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.