Click here to Skip to main content
16,016,535 members
Home / Discussions / C#
   

C#

 
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 
GeneralRe: Copy DataTable into a Ms Access table Pin
Member 1464251030-Sep-20 22:15
Member 1464251030-Sep-20 22:15 
GeneralRe: Copy DataTable into a Ms Access table Pin
OriginalGriff30-Sep-20 23:06
mveOriginalGriff30-Sep-20 23:06 
AnswerRe: Copy DataTable into a Ms Access table Pin
Gerry Schmitz1-Oct-20 5:14
mveGerry Schmitz1-Oct-20 5:14 
Questionwant to insert leave dates for weekdays excluding weekends from given date range using c# ASP.net Pin
shwetaliv23-Sep-20 2:12
shwetaliv23-Sep-20 2:12 
AnswerRe: want to insert leave dates for weekdays excluding weekends from given date range using c# ASP.net Pin
OriginalGriff23-Sep-20 2:30
mveOriginalGriff23-Sep-20 2:30 
AnswerRe: want to insert leave dates for weekdays excluding weekends from given date range using c# ASP.net Pin
Dave Kreskowiak23-Sep-20 4:07
mveDave Kreskowiak23-Sep-20 4:07 
AnswerRe: want to insert leave dates for weekdays excluding weekends from given date range using c# ASP.net Pin
Victor Nijegorodov23-Sep-20 8:45
Victor Nijegorodov23-Sep-20 8:45 
AnswerRe: want to insert leave dates for weekdays excluding weekends from given date range using c# ASP.net Pin
Mycroft Holmes23-Sep-20 12:12
professionalMycroft Holmes23-Sep-20 12:12 
GeneralRe: want to insert leave dates for weekdays excluding weekends from given date range using c# ASP.net Pin
GenJerDan24-Sep-20 21:37
GenJerDan24-Sep-20 21:37 
GeneralRe: want to insert leave dates for weekdays excluding weekends from given date range using c# ASP.net Pin
Mycroft Holmes25-Sep-20 12:21
professionalMycroft Holmes25-Sep-20 12: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 13:48
professionalRichard Andrew x6423-Sep-20 13:48 
AnswerRe: want to insert leave dates for weekdays excluding weekends from given date range using c# ASP.net Pin
shwetaliv23-Sep-20 20:41
shwetaliv23-Sep-20 20:41 
GeneralRe: want to insert leave dates for weekdays excluding weekends from given date range using c# ASP.net Pin
Richard MacCutchan23-Sep-20 21:32
mveRichard MacCutchan23-Sep-20 21:32 
GeneralRe: want to insert leave dates for weekdays excluding weekends from given date range using c# ASP.net Pin
OriginalGriff23-Sep-20 22:00
mveOriginalGriff23-Sep-20 22:00 
GeneralRe: want to insert leave dates for weekdays excluding weekends from given date range using c# ASP.net Pin
shwetaliv23-Sep-20 23:50
shwetaliv23-Sep-20 23:50 
GeneralRe: want to insert leave dates for weekdays excluding weekends from given date range using c# ASP.net Pin
OriginalGriff23-Sep-20 23:54
mveOriginalGriff23-Sep-20 23: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.