Click here to Skip to main content
15,921,113 members
Home / Discussions / C#
   

C#

 
GeneralRe: COM exception loss Pin
Member 126326017-Oct-20 22:58
Member 126326017-Oct-20 22:58 
GeneralRe: COM exception loss Pin
Richard MacCutchan7-Oct-20 23:24
mveRichard MacCutchan7-Oct-20 23:24 
AnswerRe: COM exception loss Pin
OriginalGriff8-Oct-20 4:10
mveOriginalGriff8-Oct-20 4:10 
QuestionScanning for servers Pin
pkfox4-Oct-20 21:52
professionalpkfox4-Oct-20 21:52 
AnswerRe: Scanning for servers Pin
Richard Deeming5-Oct-20 2:44
mveRichard Deeming5-Oct-20 2:44 
GeneralRe: Scanning for servers Pin
pkfox5-Oct-20 3:44
professionalpkfox5-Oct-20 3:44 
GeneralRe: Scanning for servers Pin
pkfox5-Oct-20 4:17
professionalpkfox5-Oct-20 4:17 
Questionversion mismatch Pin
Member 149246074-Oct-20 9:30
Member 149246074-Oct-20 9:30 
AnswerRe: version mismatch Pin
Richard Deeming5-Oct-20 2:33
mveRichard Deeming5-Oct-20 2:33 
GeneralRe: version mismatch Pin
Member 149246075-Oct-20 7:45
Member 149246075-Oct-20 7:45 
GeneralRe: version mismatch Pin
Richard Deeming5-Oct-20 21:22
mveRichard Deeming5-Oct-20 21:22 
QuestionprintDocument Pin
Member 149437371-Oct-20 19:02
Member 149437371-Oct-20 19:02 
AnswerRe: printDocument Pin
Gerry Schmitz1-Oct-20 19:11
mveGerry Schmitz1-Oct-20 19:11 
GeneralRe: printDocument Pin
Member 149437371-Oct-20 22:54
Member 149437371-Oct-20 22:54 
AnswerRe: printDocument Pin
OriginalGriff1-Oct-20 20:03
mveOriginalGriff1-Oct-20 20:03 
GeneralRe: printDocument Pin
Member 149437371-Oct-20 22:37
Member 149437371-Oct-20 22:37 
GeneralRe: printDocument Pin
OriginalGriff1-Oct-20 22:40
mveOriginalGriff1-Oct-20 22:40 
QuestionHow to compare on DPFP.Template to another DPFP.Template Pin
Member 144684061-Oct-20 3:07
Member 144684061-Oct-20 3:07 
AnswerRe: How to compare on DPFP.Template to another DPFP.Template Pin
Gerry Schmitz1-Oct-20 4:49
mveGerry Schmitz1-Oct-20 4:49 
GeneralRe: How to compare on DPFP.Template to another DPFP.Template Pin
Member 144684061-Oct-20 8:39
Member 144684061-Oct-20 8:39 
GeneralRe: How to compare on DPFP.Template to another DPFP.Template Pin
Gerry Schmitz2-Oct-20 4:31
mveGerry Schmitz2-Oct-20 4:31 
GeneralRe: How to compare on DPFP.Template to another DPFP.Template Pin
Member 144684062-Oct-20 20:35
Member 144684062-Oct-20 20:35 
GeneralRe: How to compare on DPFP.Template to another DPFP.Template Pin
Gerry Schmitz3-Oct-20 3:11
mveGerry Schmitz3-Oct-20 3:11 
QuestionCopy DataTable into a Ms Access table Pin
Member 1464251030-Sep-20 21:31
Member 1464251030-Sep-20 21:31 
I need to copy a DataTable inside another table (MS Access) which has the same structure. I did this:

C#
DataTable dtBit = new DataTable(); 
dtBit.TableName= "Macchine_Bit"; 

using (OleDbCommand cmd = new OleDbCommand("SELECT * FROM [Macchine_Bit] ORDER BY [FIELD_ID]", cnn))
{
	using (OleDbDataAdapter da = new OleDbDataAdapter(cmd))
	{
		da.MissingSchemaAction = MissingSchemaAction.AddWithKey;
		da.Fill(dtBit = new DataTable());
	}
}


When I got my DataTable, I open a connection to another mdb file and try to put the contents of dtBit table into another:

C#
cnn.ConnectionString = String.Format(myConnectionString, mdbCopyName);
cnn.Open();

using (OleDbDataAdapter a = new OleDbDataAdapter("SELECT * FROM [Macchine_Bit]", cnn))
{
	OleDbCommandBuilder cb = new OleDbCommandBuilder(a);
	a.MissingSchemaAction = MissingSchemaAction.AddWithKey;
	a.InsertCommand = cb.GetInsertCommand();
	a.DeleteCommand = cb.GetDeleteCommand();
	a.UpdateCommand = cb.GetUpdateCommand();
	a.TableMappings.Add("Macchine_Bit", "Macchine_Bit");                

	DataTable dtBit2 = new DataTable();
	a.Fill(dtBit2);

	dtBit2.Merge(dtBit);
	a.Update(dtBit2);
}


Basically no rows are written. What's wrong with my code? I got non error
AnswerRe: Copy DataTable into a Ms Access table Pin
OriginalGriff30-Sep-20 21:59
mveOriginalGriff30-Sep-20 21:59 

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.