Click here to Skip to main content
15,794,457 members
Home / Discussions / C#
   

C#

 
GeneralRe: printDocument Pin
OriginalGriff1-Oct-20 23:40
mvaOriginalGriff1-Oct-20 23:40 
QuestionHow to compare on DPFP.Template to another DPFP.Template Pin
Member 144684061-Oct-20 4:07
Member 144684061-Oct-20 4:07 
AnswerRe: How to compare on DPFP.Template to another DPFP.Template Pin
Gerry Schmitz1-Oct-20 5:49
mveGerry Schmitz1-Oct-20 5:49 
GeneralRe: How to compare on DPFP.Template to another DPFP.Template Pin
Member 144684061-Oct-20 9:39
Member 144684061-Oct-20 9:39 
GeneralRe: How to compare on DPFP.Template to another DPFP.Template Pin
Gerry Schmitz2-Oct-20 5:31
mveGerry Schmitz2-Oct-20 5:31 
GeneralRe: How to compare on DPFP.Template to another DPFP.Template Pin
Member 144684062-Oct-20 21:35
Member 144684062-Oct-20 21:35 
GeneralRe: How to compare on DPFP.Template to another DPFP.Template Pin
Gerry Schmitz3-Oct-20 4:11
mveGerry Schmitz3-Oct-20 4:11 
QuestionCopy DataTable into a Ms Access table Pin
Member 1464251030-Sep-20 22:31
Member 1464251030-Sep-20 22: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 22:59
mvaOriginalGriff30-Sep-20 22:59 
GeneralRe: Copy DataTable into a Ms Access table Pin
Member 1464251030-Sep-20 23:15
Member 1464251030-Sep-20 23:15 
GeneralRe: Copy DataTable into a Ms Access table Pin
OriginalGriff1-Oct-20 0:06
mvaOriginalGriff1-Oct-20 0:06 
AnswerRe: Copy DataTable into a Ms Access table Pin
Gerry Schmitz1-Oct-20 6:14
mveGerry Schmitz1-Oct-20 6:14 
Questionwant to insert leave dates for weekdays excluding weekends from given date range using c# ASP.net Pin
shwetaliv23-Sep-20 3:12
shwetaliv23-Sep-20 3:12 
AnswerRe: want to insert leave dates for weekdays excluding weekends from given date range using c# ASP.net Pin
OriginalGriff23-Sep-20 3:30
mvaOriginalGriff23-Sep-20 3:30 
AnswerRe: want to insert leave dates for weekdays excluding weekends from given date range using c# ASP.net Pin
Dave Kreskowiak23-Sep-20 5:07
mveDave Kreskowiak23-Sep-20 5:07 
AnswerRe: want to insert leave dates for weekdays excluding weekends from given date range using c# ASP.net Pin
Victor Nijegorodov23-Sep-20 9:45
Victor Nijegorodov23-Sep-20 9:45 
AnswerRe: want to insert leave dates for weekdays excluding weekends from given date range using c# ASP.net Pin
Mycroft Holmes23-Sep-20 13:12
professionalMycroft Holmes23-Sep-20 13:12 
GeneralRe: want to insert leave dates for weekdays excluding weekends from given date range using c# ASP.net Pin
GenJerDan24-Sep-20 22:37
GenJerDan24-Sep-20 22:37 
GeneralRe: want to insert leave dates for weekdays excluding weekends from given date range using c# ASP.net Pin
Mycroft Holmes25-Sep-20 13:21
professionalMycroft Holmes25-Sep-20 13:21 
AnswerRe: want to insert leave dates for weekdays excluding weekends from given date range using c# ASP.net Pin
Richard Andrew x6423-Sep-20 14:48
professionalRichard Andrew x6423-Sep-20 14:48 
AnswerRe: want to insert leave dates for weekdays excluding weekends from given date range using c# ASP.net Pin
shwetaliv23-Sep-20 21:41
shwetaliv23-Sep-20 21:41 
GeneralRe: want to insert leave dates for weekdays excluding weekends from given date range using c# ASP.net Pin
Richard MacCutchan23-Sep-20 22:32
mveRichard MacCutchan23-Sep-20 22:32 
GeneralRe: want to insert leave dates for weekdays excluding weekends from given date range using c# ASP.net Pin
OriginalGriff23-Sep-20 23:00
mvaOriginalGriff23-Sep-20 23:00 
GeneralRe: want to insert leave dates for weekdays excluding weekends from given date range using c# ASP.net Pin
shwetaliv24-Sep-20 0:50
shwetaliv24-Sep-20 0:50 
GeneralRe: want to insert leave dates for weekdays excluding weekends from given date range using c# ASP.net Pin
OriginalGriff24-Sep-20 0:54
mvaOriginalGriff24-Sep-20 0:54 

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.