I am generating bulk invoices using front end and when I try to insert it to the data base it takes hours it’s unacceptable. This is how I am doing the task Get relevant Cx accounts to data tables Generates Invoice header and detail records and store those records on Invoice Header and Detail Data tables Loop the invoice header data table and Insert recodes using Strode procedure. Loop the invoice detail data table and Insert recodes using Strode procedure. To generate for 200000 invoices it takes more than 24 Hrs. How can I improve the performance? Please refer the code. //Inserting the Invoice Header records foreach(DataRow InvHDR in DS_BillData.Tables["InvoiceHeaderInformation"].Rows) { SqlParameter[] para =new SqlParameter[14]; para[0]=new SqlParameter("@GUAccountID",InvHDR["GUAccountID"]); para[1]=new SqlParameter("@GUInvID",InvHDR["GUInvoiceID"]); para[2]=new SqlParameter("@InvoiceNo",InvHDR["InvoiceNo"]); para[3]=new SqlParameter("@InvoiceDate",StartDate); para[4]=new SqlParameter("@DueDate",DueDate); para[5]=new SqlParameter("@BatchNo",BatchID); para[6]=new SqlParameter("@GUStatmentID",InvHDR["GUInvoiceID"]); para[7]=new SqlParameter("@BatchSNCount",BatchSNCount); para[8]=new SqlParameter("@PAYMENTRECIVED",InvHDR["PAYMENTRECIVED"]); para[9]=new SqlParameter("@SubTotal",InvHDR["SubTotal"]); para[10]=new SqlParameter("@InvoiceAmount",InvHDR["InvoiceAmount"]); para[11]=new SqlParameter("@VAT",InvHDR["VAT"]); para[12]=new SqlParameter("@OtherTax",InvHDR["OtherTax"]); para[13]=new SqlParameter("@StatmentNo",InvHDR["InvoiceNo"]); //para[13]=new SqlParameter("@WaveOFF","Y"); callSp("BillingInvoiceCreation_forFront",para); } Stored Procedure--- Procedure BillingInvoiceCreation_forFront ( @GUAccountID as nvarchar(30), @GUInvID as nvarchar(30), @InvoiceNo as numeric, @InvoiceDate as datetime, @DueDate as datetime, @BatchNo as Decimal, @GUStatmentID as nvarchar(30), @StatmentNo as numeric, @BatchSNCount as decimal, @PAYMENTRECIVED as decimal(9,2), @SubTotal as decimal(9,2), @InvoiceAmount as decimal(9,2), @VAT as decimal(9,2), @OtherTax as decimal(9,2) ) as BEGIN Declare @PrintDescription as nvarchar(100) Declare @GUItemID as nvarchar(30) Declare @PaymentAmt as decimal(9,2) Declare @DueAmount as decimal(9,2) Declare @CreditNoteAmount as decimal(9,2) Declare @BFAmount as decimal(9,2) INSERT INTO B_BillingInvoiceHead
Daminda
Posts
-
Inserting bulk data to SQL DB (SQL 2000) [modified] -
Print a batch using Crytal ReportHi :) I want to print a batch of invoices using crystal report. Now I am doing this using selection formula so it will send report by report to the printer. There is an option call Group selection formula but I don’t know how to use this, is it a another way to get it done??? Shone
-
SQL Replication ConflictsHI, I Configured a SQL Server with Merge Replication after few days some tables got some conflicts one table got 10012 conflict Records. Any one there to help me to solve this how to resolve this records or how can I avoid this conflicts? (That particular table has a Trigger it calculate daily balance)
-
Communicationi want to open cash drower when i print a report how should i do this using Com port or LPT port. can any one help me out there. thanks.
-
delete datagird rowi want to delete selected row by pressing delete button on keyboard ...also i want to know the evet when deleteing row on datagrid ...:)
-
DatagridIn my C# winforms datagrid, how do I get the value of the selected cell?
-
Indexers in Vb.NetHi How can i create indexers in Vb.Net Thanks
-
Write into a text fileI want to Write a line into a existing Text file Ex Line1 Line2 Line3 I want to replace Line2 With NewLine2 How can I seek a particular Line (move to a given line & Replace it) ____________________________________________________________________ This is append the file but i want to edit the file myProp = Value.Split(",") Dim sr As StreamWriter = File.AppendText(FILE_NAME) sr.WriteLine(myProp(0)) sr.WriteLine(myProp(1)) sr.WriteLine(myProp(2)) sr.WriteLine(myProp(3)) sr.Close() _____________________________________________________________________ :((
-
Close resource Open by a web camI want to close resource used by the web cam it gives error when i open the camara.......
-
Open DAO RecordsetI want to open a DAO Recordset Database tempDB; Recordset rstbl; rstbl = tempDB.OpenRecordset("SELECT Name FROM myTblNames", DAO.RecordsetTypeEnum.dbOpenTable, DAO.RecordsetOptionEnum.dbReadOnly , DAO.LockTypeEnum.dbPessimistic ); Error is Invalid argument
-
grant permission to access the MsysobjectsI need to know how can we grant permission to access the Msysobjects through C# coding. Any kind of suggestion is highly appreciated!
-
Grant permission to access the MsysobjectsI need to know how can we grant permission to access the Msysobjects through C# coding. Any kind of suggestion is highly appreciated!
-
Listing the tables of MS Access (Error is This):(( OleDbConnection conn = new OleDbConnection(string.Format("Provider=Microsoft.Jet.OLEDB.4.0;Data Source={0};Mode=ReadWrite",txtDbPath.Text)); OleDbCommand cmd = conn.CreateCommand(); cmd.CommandText = "SELECT Name FROM MSysObjects WHERE Type = 1"; OleDbDataReader reader = null; try { conn.Open(); reader = cmd.ExecuteReader(); while (reader.Read()) { Console.WriteLine(reader.GetString(0)); lstTables.Items.Add (reader.GetName(0).ToString()); } } catch (Exception ex) { // Providing something like this in your ...(continued) Console.Error.WriteLine("An error occured: {0}", ex.Message); MessageBox.Show(ex.Message.ToString()); } finally { if (reader != null) reader.Close(); conn.Close(); } Error is An error occured: Record(s) cannot be read; no read permission on 'MSysObjects'.
-
Table Names Of a MS Access DatabaseI Want to List the Table Names Of a MS Access Database Using ADO Connection. This is How I tried ADODB.Connection myConnection = new ADODB.ConnectionClass(); ADODB.Recordset rsTblNames = new ADODB.RecordsetClass(); if (optAccess.Checked) { ConnStr= "Provider=Microsoft.Jet.OLEDB.4.0;User ID=;Data Source="+ txtDbPath.Text +";Mode=ReadWrite;Extended Properties='';Jet OLEDB:System database='';Jet OLEDB:Registry Path='';Jet OLEDB:Engine Type=5;Jet OLEDB:Database Locking Mode=0;Jet OLEDB:Global Partial Bulk Ops=2;Jet OLEDB:Global Bulk Transactions=1;Jet OLEDB:Create System Database=False;Jet OLEDB:Encrypt Database=False;Jet OLEDB:Don't Copy Locale on Compact=False;Jet OLEDB:Compact Without Replica Repair=False;Jet OLEDB:SFP=False"; myConnection.Open(ConnStr,"","",0); StrSql= "SELECT Name FROM MSysObjects WHERE Type = 1"; rsTblNames.Open(StrSql, myConnection, ADODB.CursorTypeEnum.adOpenKeyset, ADODB.LockTypeEnum.adLockReadOnly,0); } But This returns a Error
-
Table Names Of a MS Access DatabaseI Want to List the Table Names Of a MS Access Database Using ADO Connection. This is How I tried ADODB.Connection myConnection = new ADODB.ConnectionClass(); ADODB.Recordset rsTblNames = new ADODB.RecordsetClass(); if (optAccess.Checked) { ConnStr= "Provider=Microsoft.Jet.OLEDB.4.0;User ID=;Data Source="+ txtDbPath.Text +";Mode=ReadWrite;Extended Properties='';Jet OLEDB:System database='';Jet OLEDB:Registry Path='';Jet OLEDB:Engine Type=5;Jet OLEDB:Database Locking Mode=0;Jet OLEDB:Global Partial Bulk Ops=2;Jet OLEDB:Global Bulk Transactions=1;Jet OLEDB:Create System Database=False;Jet OLEDB:Encrypt Database=False;Jet OLEDB:Don't Copy Locale on Compact=False;Jet OLEDB:Compact Without Replica Repair=False;Jet OLEDB:SFP=False"; myConnection.Open(ConnStr,"","",0); StrSql= "SELECT Name FROM MSysObjects WHERE Type = 1"; rsTblNames.Open(StrSql, myConnection, ADODB.CursorTypeEnum.adOpenKeyset, ADODB.LockTypeEnum.adLockReadOnly,0); } But This returns a Error