How to create and load data in to an excel worksheet of an existing excel file using ASP.NET, ADO.NET, and Visual C# .NET

Hi,

I am using ASP.net with C# 1.1 version.

Currently I am generating an report using an excel file.

I created and loaded data in to an file using ASP.NET, ADO.NET, and Visual C# .NET.

But when the rows of a dataset having count which is greater than 65536 I got error as "Spreadsheet is full".

So I want to dynamically create an excel worksheet for the existing excel file and load data in to it using ASP.NET, ADO.NET, and Visual C# .NET.

Suppose if the rows are 80000 and I want a code to create an excel worksheet for the excel file with 65536 in one worksheet and remaining to be loaded to another worksheet.

Could any of you please help on this.

Thanks,

Suresh

0
suresh
12/18/2008 10:05:47 AM
asp.net.object-datasource 16182 articles. 0 followers. Follow

25 Replies
1839 Views

Similar Articles

[PageSpeed] 3

Hi suresh.kirupakaran@hotmail.com,

Based on my expirence, excel file is not the most suitable to store a very large data. Maybe it has some limitation as you described above. Since the data is very large, I recommend you to use SQL Server instead to avoid the problem if it's possible. Also, you can manage the data more easier than excel does.

Thanks.


David Qian
Microsoft Online Community Support

Please remember to mark the replies as answers if they help and unmark them if they provide no help.
0
Wencui
12/23/2008 3:21:16 AM

Hi, 

 I have a problem now, I just created two excel sheets and I loading the data to a datatable in a dataset. If the rows are greater than 65536, then I load the remaining in the second datatable of a dataset.

But while calling the update method of OledbAdapter after the first sheet get filled it throws error as "Spreadsheet is full". OledbAdapter.Update(dataset) or even I tried OledbAdapter.Update(datatable). Since i m not using insert query to insert in to the datatable. I have a dataset which I got from someother data and using that dataset i want to fill another dataset and load it in to an excel file.

How to load the two tables from a dataset in to two different excel sheets using OleDbAdapter. Could you please help on this.

Thanks,

Suresh

0
suresh
2/12/2009 6:01:45 AM

Hi, 

 I have a problem now, I just created two excel sheets and I loading the data to a datatable in a dataset. If the rows are greater than 65536, then I load the remaining in the second datatable of a dataset.

But while calling the update method of OledbAdapter after the first sheet get filled it throws error as "Spreadsheet is full". OledbAdapter.Update(dataset) or even I tried OledbAdapter.Update(datatable). Since i m not using insert query to insert in to the datatable. I have a dataset which I got from someother data and using that dataset i want to fill another dataset and load it in to an excel file.

How to load the two tables from a dataset in to two different excel sheets using OleDbAdapter. Could you please help on this.

Thanks,

Suresh

0
suresh
2/12/2009 6:03:21 AM

Hi, 

 I have a problem now, I just created two excel sheets and I loading the data to a datatable in a dataset. If the rows are greater than 65536, then I load the remaining in the second datatable of a dataset.

But while calling the update method of OledbAdapter after the first sheet get filled it throws error as "Spreadsheet is full". OledbAdapter.Update(dataset) or even I tried OledbAdapter.Update(datatable). Since i m not using insert query to insert in to the datatable. I have a dataset which I got from someother data and using that dataset i want to fill another dataset and load it in to an excel file.

How to load the two tables from a dataset in to two different excel sheets using OleDbAdapter. Could you please help on this.

Thanks,

Suresh

0
suresh
2/12/2009 6:04:35 AM

Hi, 

 I have a problem now, I just created two excel sheets and I loading the data to a datatable in a dataset. If the rows are greater than 65536, then I load the remaining in the second datatable of a dataset.

But while calling the update method of OledbAdapter after the first sheet get filled it throws error as "Spreadsheet is full". OledbAdapter.Update(dataset) or even I tried OledbAdapter.Update(datatable). Since i m not using insert query to insert in to the datatable. I have a dataset which I got from someother data and using that dataset i want to fill another dataset and load it in to an excel file.

How to load the two tables from a dataset in to two different excel sheets using OleDbAdapter. Could you please help on this.

Thanks,

Suresh

0
suresh
2/12/2009 6:16:10 AM

suresh.kirupakaran@hotmail.com:

Hi, 

 I have a problem now, I just created two excel sheets and I loading the data to a datatable in a dataset. If the rows are greater than 65536, then I load the remaining in the second datatable of a dataset.

But while calling the update method of OledbAdapter after the first sheet get filled it throws error as "Spreadsheet is full". OledbAdapter.Update(dataset) or even I tried OledbAdapter.Update(datatable). Since i m not using insert query to insert in to the datatable. I have a dataset which I got from someother data and using that dataset i want to fill another dataset and load it in to an excel file.

How to load the two tables from a dataset in to two different excel sheets using OleDbAdapter. Could you please help on this.

Thanks,

Suresh

To create an excel sheet refer here and export it

http://www.aspsnippets.com/post/2009/01/31/Export-Data-To-Excel-using-ADONet.aspx

 


MAKMark as Answer if this reply helps you
MVP ASP/ASP.Net
MVP ASP/ASP.Net
ASP.Net Hosting : Host DepotMy Site : ASPSnippets
0
mudassarkhan
2/12/2009 6:27:52 AM

suresh.kirupakaran@hotmail.com:

How to load the two tables from a dataset in to two different excel sheets using OleDbAdapter. Could you please help on this.

you read my article there I have provide an option to povide the sheet name you are updating the same sheet again and again

Change the sheetname in the query


MAKMark as Answer if this reply helps you
MVP ASP/ASP.Net
MVP ASP/ASP.Net
ASP.Net Hosting : Host DepotMy Site : ASPSnippets
0
mudassarkhan
2/12/2009 6:35:29 AM

Hi,

I am updating two different tablenames for two different excel sheets but both the update are going to the same sheet.

I have two sheets Report1 and Report2 and I created using Create command and at last I checked the excel the two sheets are created with the same name.

I am having a dataset in that I am having two different data tables for the two sheets.  I am filling the tables using

datarow newrow = dataset.tables[0].newrow();

and filling the new row after that I just adding the rows to the table 

 tables.rows.add(newrow)

Like this I am filling the two data tables. At last I am calling the update method as

Oledbapdater.Update(table1);

Oledbapdater.Update(table2);

While calling the second update it throws error as spreadsheet full and the first table contains 65535 records and second contains 533 rows.

Could you please help on this.

Thanks,

Suresh 

 

 

0
suresh
2/12/2009 6:44:07 AM

You still did not get you are not changing the command objects query

cmd = new OleDBCommand(Query1);

Oledbapdater.SelectCommand = cmd;

Oledbapdater.Update(table1);

//Now a new query and command here

cmd = new OleDBCommand(Query2);

Oledbapdater.SelectCommand = cmd;

Oledbapdater.Update(table2);


MAKMark as Answer if this reply helps you
MVP ASP/ASP.Net
MVP ASP/ASP.Net
ASP.Net Hosting : Host DepotMy Site : ASPSnippets
0
mudassarkhan
2/12/2009 6:52:07 AM

Hi,

I tried the above for that I am getting error  while I run the

Oledbapdater.SelectCommand = cmd;

The error is "The DataAdapter.SelectCommand.Connection Property needs to be initialized.

Kindly help on this.

 

Thanks,

Suresh 

 

0
suresh
2/12/2009 7:05:09 AM

Paste the code


MAKMark as Answer if this reply helps you
MVP ASP/ASP.Net
MVP ASP/ASP.Net
ASP.Net Hosting : Host DepotMy Site : ASPSnippets
0
mudassarkhan
2/12/2009 7:10:47 AM

Hi,

I tried the above for that I am getting error  while I run the

Oledbapdater.SelectCommand = cmd;

The error is "The DataAdapter.SelectCommand.Connection Property needs to be initialized.

Kindly help on this.

 

Thanks,

Suresh 

 

0
suresh
2/12/2009 7:11:16 AM

Hi

I  just pasted the entire code, Pls check this fully and give the soln to load the two sheets.

 

using System;
using System.Collections;
using System.ComponentModel;
using System.Data.Common;
using System.Data.OleDb;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using System.Runtime.InteropServices;
using System.Reflection;
using System.Text;
using Excel;

namespace TestApplication
{
   
    public class WebForm5 : System.Web.UI.Page
    {
        private void Page_Load(object sender, System.EventArgs e)
        {            
            string pstrESheet1="TESTNG2";
            string pstrESheet="TESTNG1";
            string mstrExcelFile = "C:\\Inetpub\\wwwroot\\Cosmit.UI\\Donnees\\EnLecture\\Excel\\Report\\COSMIT-test001-20080613.xls";
            string mstrExcelFilenew = "C:\\Inetpub\\wwwroot\\Cosmit.UI\\Donnees\\EnLecture\\Excel\\Report\\COSMIT-test001-20090211.xls";
            string pstrEConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" +
                "Data Source=" + mstrExcelFile + ";" +
                @"Extended Properties=""Excel 8.0;HDR=YES""";

            string pstrEConnectionStringnew = "Provider=Microsoft.Jet.OLEDB.4.0;" +
                "Data Source=" + mstrExcelFilenew + ";" +
                @"Extended Properties=""Excel 8.0;HDR=YES""";

            OleDbConnection objConnnew = null;
            OleDbConnection objConn = null;
            OleDbDataAdapter dtAdapt = null;
            OleDbDataAdapter dtAdapt1 = null;
            System.Data.DataSet dsExcel = new System.Data.DataSet();
            System.Data.DataSet dsOracle = new System.Data.DataSet();
            System.Data.DataTable dtExcelTable = new System.Data.DataTable();    
            dsOracle.Tables.Add();
            dsOracle.Tables.Add();

            try
            {                    
                objConnnew = new OleDbConnection(pstrEConnectionString);                                    
                objConnnew.Open();    
                dtAdapt = new OleDbDataAdapter("Select * from [Report]",objConnnew);
                dtAdapt.Fill(dsOracle.Tables[0]);
                dtAdapt1 = new OleDbDataAdapter("Select * from [Report1]",objConnnew);
                dtAdapt.Fill(dsOracle.Tables[1]);
                objConnnew.Close();
    
                objConn = new OleDbConnection(pstrEConnectionStringnew);                                    
                objConn.Open();

                StringBuilder requestCreate = new StringBuilder();
                StringBuilder requestCreateNew = new StringBuilder();
                StringBuilder requestInsert = new StringBuilder();
                StringBuilder requestInsertNew = new StringBuilder();
                if (dsOracle != null && dsOracle.Tables.Count > 0 && dsOracle.Tables[0] != null)
                {
                    requestCreate.Append("CREATE TABLE " + pstrESheet + " (");
                    requestInsert.Append("INSERT INTO "  + pstrESheet + " (");
                    bool firstColumn = true;
                    foreach (System.Data.DataColumn column in dsOracle.Tables[0].Columns)
                    {
                        if (firstColumn)
                        {
                            requestCreate.Append(column.ColumnName + " ");
                            requestInsert.Append(column.ColumnName + " ");
                            firstColumn = false;
                        }
                        else
                        {
                            requestCreate.Append(", " + column.ColumnName + " ");
                            requestInsert.Append(", " + column.ColumnName + " ");
                        }
                        
                        if ( column.DataType == typeof(System.Decimal) )
                        {
                            requestCreate.Append("numeric");
                        }
                        else if ( column.DataType == typeof(System.DateTime) )
                        {
                            requestCreate.Append("datetime");
                        }
                        else // par défaut on crée une colonne de type texte
                        {
                            requestCreate.Append("varchar");
                        }
                    }
                    requestCreate.Append(")");
                    requestInsert.Append(") VALUES (");

                }
                
                OleDbCommand cmdCreate = new OleDbCommand(requestCreate.ToString(), objConn);
                cmdCreate.ExecuteNonQuery();                

                OleDbDataAdapter oleDbadapter = new OleDbDataAdapter("select * from " + pstrESheet, objConn);                
                oleDbadapter.Fill(dsExcel, pstrESheet);                
                OleDbCommandBuilder cb = new OleDbCommandBuilder(oleDbadapter);    
                int rows = dsOracle.Tables[0].Rows.Count + dsOracle.Tables[1].Rows.Count;
                
                if (rows > 65535)
                {            
                    requestCreateNew.Append("CREATE TABLE " + pstrESheet1 + " (");     
                    requestInsertNew.Append("INSERT INTO "  + pstrESheet1 + " (");
                    bool firstColumn = true;
                    foreach (System.Data.DataColumn column in dsOracle.Tables[1].Columns)
                    {
                        if (firstColumn)
                        {
                            requestCreateNew.Append(column.ColumnName + " ");
                            requestInsertNew.Append(column.ColumnName + " ");
                            firstColumn = false;
                        }
                        else
                        {
                            requestCreateNew.Append(", " + column.ColumnName + " ");
                            requestInsertNew.Append(", " + column.ColumnName + " ");
                        }
                        
                        if ( column.DataType == typeof(System.Decimal) )
                        {
                            requestCreateNew.Append("numeric");
                        }
                        else if ( column.DataType == typeof(System.DateTime) )
                        {
                            requestCreateNew.Append("datetime");
                        }
                        else // par défaut on crée une colonne de type texte
                        {
                            requestCreateNew.Append("varchar");
                        }
                    }
                    requestCreateNew.Append(")");
                    requestInsertNew.Append(") VALUES (");
                    OleDbCommand cmdCreate1 = new OleDbCommand(requestCreateNew.ToString(), objConn);
                    cmdCreate1.ExecuteNonQuery();

                    OleDbDataAdapter oleDbadapter1 = new OleDbDataAdapter("select * from " + pstrESheet, objConn);                
                    oleDbadapter1.Fill(dsExcel, pstrESheet1);                
                    OleDbCommandBuilder cb1 = new OleDbCommandBuilder(oleDbadapter1);    
                }
                
                int Rowcount = 0;
                bool firstColumn1 = true;
                foreach (System.Data.DataRow row in dsOracle.Tables[0].Rows)
                {
                    StringBuilder requestInsertNew1 = new StringBuilder();
                    if (Rowcount < 65535)
                    {
                        System.Data.DataRow excelRow = dsExcel.Tables[pstrESheet].NewRow();
                        firstColumn1 = true;
                        
                        for (int i = 0; i < dsOracle.Tables[0].Columns.Count; i++)
                        {

                            if(dsOracle.Tables[0].Columns[i].DataType == typeof(System.String))
                            {
                                if(row[i] != null && row[i].ToString().Length > 255)
                                    row[i] = row[i].ToString().Substring(0, 255);
                            }
                            excelRow[i] = row[i];
                        }
//                        requestInsertNew1.Append(")");
                        dsExcel.Tables[pstrESheet].Rows.Add(excelRow);
//                        OleDbCommand cmdInsert = new OleDbCommand(requestInsertNew.ToString() + requestInsertNew1.ToString(), objConn);
//                        cmdInsert.ExecuteNonQuery();
                    }
                    else
                    {
                        System.Data.DataRow excelRow = dsExcel.Tables[pstrESheet1].NewRow();                        
                        for (int i = 0; i < dsOracle.Tables[1].Columns.Count; i++)
                        {
                            if(dsOracle.Tables[0].Columns[i].DataType == typeof(System.String))
                            {
                                if(row[i] != null && row[i].ToString().Length > 255)
                                    row[i] = row[i].ToString().Substring(0, 255);
                            }
                            excelRow[i] = row[i];
                        }
                        dsExcel.Tables[pstrESheet1].Rows.Add(excelRow);
                    }
                    Rowcount++;
                }    
                foreach (System.Data.DataRow row in dsOracle.Tables[0].Rows)
                {
                    System.Data.DataRow excelRow = dsExcel.Tables[pstrESheet1].NewRow();
                    //excelRow.ItemArray = row.ItemArray;
                    for (int i = 0; i < dsOracle.Tables[0].Columns.Count; i++)
                    {
                        if(dsOracle.Tables[0].Columns[i].DataType == typeof(System.String))
                        {
                            if(row[i] != null && row[i].ToString().Length > 255)
                                row[i] = row[i].ToString().Substring(0, 255);
                        }
                        excelRow[i] = row[i];
                    }
                    dsExcel.Tables[pstrESheet1].Rows.Add(excelRow);
                }
                OleDbCommand cmd = new OleDbCommand("Select * from [pstrESheet]");
                OleDbDataAdapter oleDbadapter1 = new OleDbDataAdapter(cmd,objConn);                
                oleDbadapter1.Update(dsExcel.Tables[pstrESheet]);

                OleDbCommand cmd1 = new OleDbCommand("Select * from [pstrESheet1]");
                oleDbadapter.SelectCommand = cmd1;
                oleDbadapter.Update(dsExcel.Tables[pstrESheet1]);

                //oleDbadapter.Update(dsExcel.GetChanges(),pstrESheet);

                //oleDbadapter.Update(dsExcel.GetChanges(),pstrESheet1);
                //oleDbadapter.Update(dsExcel.Tables[pstrESheet1]);    
            
            }
            catch (Exception ex)
            {
                Response.Write(ex.ToString());
            }
            finally
            {
                if ( objConn != null)
                {
                    objConn.Close();
                    objConn.Dispose();
                }
            }                
        }
        

        #region Web Form Designer generated code
        override protected void OnInit(EventArgs e)
        {
            //
            // CODEGEN: This call is required by the ASP.NET Web Form Designer.
            //
            InitializeComponent();
            base.OnInit(e);
        }
        
        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {    
            this.Load += new System.EventHandler(this.Page_Load);
        }
        #endregion
    }
}

0
suresh
2/12/2009 7:18:05 AM

try this

objConnnew = new OleDbConnection(pstrEConnectionString);                                    
OleDbCommand cmd = new OleDbCommand("Select * from [pstrESheet]");

objConnnew.Open();   
oleDbDataAdapter oleDbadapter = new OleDbDataAdapter(cmd,objConnnew );                
OoeDbadapter.Update(dsExcel.Tables[pstrESheet]);

    
objConn = new OleDbConnection(pstrEConnectionStringnew);  

objConn.Open();   

OleDbCommand cmd1 = new OleDbCommand("Select * from [pstrESheet1]");
oleDbDataAdapter oleDbadapter1 = new OleDbDataAdapter(cmd,objConn);       
oleDbadapter1.Update(dsExcel.Tables[pstrESheet1]);
                               


MAKMark as Answer if this reply helps you
MVP ASP/ASP.Net
MVP ASP/ASP.Net
ASP.Net Hosting : Host DepotMy Site : ASPSnippets
0
mudassarkhan
2/12/2009 8:02:04 AM

hi,

Here also its throwing the error for the below line 

oleDbDataAdapter oleDbadapter = new OleDbDataAdapter(cmd,objConnnew ); 

It will take only string parameters not the cmdobj and conn object.

Can u check on this.

Thanks,

Suresh 

 

 

0
suresh
2/12/2009 8:39:33 AM

try this one

 

objConnnew = new OleDbConnection(pstrEConnectionString);                                    
OleDbCommand cmd = new OleDbCommand("Select * from [pstrESheet]");

objConnnew.Open();   
oleDbDataAdapter oleDbadapter = new OleDbDataAdapter(cmd);                
OoeDbadapter.Update(dsExcel.Tables[pstrESheet]);

    
objConn = new OleDbConnection(pstrEConnectionStringnew);  

objConn.Open();   

OleDbCommand cmd1 = new OleDbCommand("Select * from [pstrESheet1]");
oleDbDataAdapter oleDbadapter1 = new OleDbDataAdapter(cmd1);       
oleDbadapter1.Update(dsExcel.Tables[pstrESheet1]);


MAKMark as Answer if this reply helps you
MVP ASP/ASP.Net
MVP ASP/ASP.Net
ASP.Net Hosting : Host DepotMy Site : ASPSnippets
0
mudassarkhan
2/12/2009 8:43:49 AM

Hi,

While compiling iteslf the below line throws error

oleDbDataAdapter oleDbadapter = new OleDbDataAdapter(cmd,objConnnew );                 

Since the Oledbadapter wont take the parameters as cmd object and conn object.

Could you please provide some other solution.

 

Thanks,

Suresh 

 

0
suresh
2/12/2009 8:48:39 AM

Hi,

While running the update cmd as the line below

OleDbadapter.Update(dsExcel.Tables[pstrESheet]);

It throws error as "Update requires a valid Insert Command when passed DataRow collection with new rows";

Could you please provide the solution.

 

Thanks,

Suresh

0
suresh
2/12/2009 9:02:54 AM

suresh.kirupakaran@hotmail.com:

Hi,

While running the update cmd as the line below

OleDbadapter.Update(dsExcel.Tables[pstrESheet]);

It throws error as "Update requires a valid Insert Command when passed DataRow collection with new rows";

Could you please provide the solution.

 

Thanks,

Suresh

For inserting you need an insert query Refer my article

I'll suggest download the code and use that and if it works modify yours


MAKMark as Answer if this reply helps you
MVP ASP/ASP.Net
MVP ASP/ASP.Net
ASP.Net Hosting : Host DepotMy Site : ASPSnippets
0
mudassarkhan
2/12/2009 9:37:23 AM

Hi,

Actually loading the excel code was done already i cant able to modify that. Now the fact is while updating i need to insert for both the worksheets of excel.

They have an dataset from the dataset they are creating another dataset and loading to and excel as below mentioned code.

They just creating a datatable for the dataset dsExcel. After that they are calling the code as

foreach (System.Data.DataRow row in dsOracle.Tables[0].Rows)
 {
                    System.Data.DataRow excelRow = dsExcel.Tables[pstrESheet1].NewRow();
                    
                    for (int i = 0; i < dsOracle.Tables[0].Columns.Count; i++)
                    {
                        if(dsOracle.Tables[0].Columns[i].DataType == typeof(System.String))
                        {
                            if(row[i] != null && row[i].ToString().Length > 255)
                                row[i] = row[i].ToString().Substring(0, 255);
                        }
                        excelRow[i] = row[i];
                    }
                    dsExcel.Tables[pstrESheet1].Rows.Add(excelRow);
                }

After this code they calling the update method

OleDbadapter.Update(dsExcel.Tables[pstrESheet]);

Which is inserting automatically to excel file, until calling this line it is not inserting to excel file.

Can you please give solution for this scenario.

Thanks,

Suresh 

 

 

0
suresh
2/12/2009 9:52:37 AM

Since you updated the datatable with new rows you will have to write a new insert or update query to update the Excel sheet

 


MAKMark as Answer if this reply helps you
MVP ASP/ASP.Net
MVP ASP/ASP.Net
ASP.Net Hosting : Host DepotMy Site : ASPSnippets
0
mudassarkhan
2/12/2009 10:03:45 AM

Hi,

Actually the code written is just they are calling the update method of OleDbDataAdapter

as

OledbDataAdapter.update(datatable)

It automatically inserts the values in to the excel file.But if it more than 65535, its throwing the error, thats the problem now.

Any solution for this scenario. No insert or update query using only update method of OleDbDataAdapter can it be possible. Please check on this.

Thanks,

Suresh

 

0
suresh
2/12/2009 10:10:56 AM

Actually. when you insert data in a datatable you cannot use the same for inserting

Can you try an insert query??


MAKMark as Answer if this reply helps you
MVP ASP/ASP.Net
MVP ASP/ASP.Net
ASP.Net Hosting : Host DepotMy Site : ASPSnippets
0
mudassarkhan
2/12/2009 10:18:57 AM

//                foreach (System.Data.DataRow row in dsExcel.Tables[pstrESheet1].Rows)
//                {
//                    StringBuilder requestInsertNew1 = new StringBuilder();   
//                    StringBuilder requestInsertNew2 = new StringBuilder();               
//                    firstColumn1 = true;   
//                    requestInsertNew2.Append("INSERT INTO "  + pstrESheet1 + " (");
//                    foreach (System.Data.DataColumn column in dsOracle.Tables[0].Columns)
//                    {
//                        if (firstColumn1)
//                            requestInsertNew2.Append(column.ColumnName + " ");
//                        else
//                            requestInsertNew2.Append(", " + column.ColumnName + " ");
//                    }
//
//                    for (int i = 0; i < dsExcel.Tables[pstrESheet1].Columns.Count; i++)
//                    {
//                        if (firstColumn1)
//                        {                           
//                            requestInsertNew1.Append(row[i]);
//                            firstColumn1 = false;
//                        }
//                        else                       
//                            requestInsertNew1.Append("," + "'"+ row[i] + "'");
//                    }
//                    requestInsertNew2.Append(") VALUES (");
//                    requestInsertNew1.Append(")");                   
//                    OleDbCommand cmdInsert = new OleDbCommand(requestInsertNew2.ToString() + requestInsertNew1.ToString(), objConn);
//                    cmdInsert.ExecuteNonQuery();  

 

I tried this but not working

Could you please help on this.

Thanks

Suresh

0
suresh
2/12/2009 10:42:57 AM

refer here http://msdn.microsoft.com/en-us/library/ms810297.aspx

they have build the insert query


MAKMark as Answer if this reply helps you
MVP ASP/ASP.Net
MVP ASP/ASP.Net
ASP.Net Hosting : Host DepotMy Site : ASPSnippets
0
mudassarkhan
2/12/2009 10:52:02 AM
Reply:

Similar Artilces:

Sending SMS using vb.net or C#.net using vb.net or c#.net
Hi  My requirement is I hav one csv file with these fields id,mobilenum,messgae,status.intiallu staus is 0. once i read the all fileds and take that mobile number.using tat mobile number  i need to send sms .after sending sms i shuld change status as 1 How to send sms thru coding (please dont provide any links.if it is provide also please give working links becox i checked codeproject .i didnt get any nice link. and also provide the how to update the status field im csv file   Thank ssandhya   To send SMS, you need some third party SMS providers. if you consul...

.Net 2.0 Web application using Vb.net is unable to create object of another dll writen in C# .net 2.0
Hi, I habe created one ASP.net web application using Vb.net which is adding reference of dlls written in C# and .net 2.0. But whenever trying to create object of referencing dll, it is throwing error :Object reference does not set to an object. But, locally it is working fine,. In the server i have deployed the .aspx files and dll files in the bin. There were already an web.config in the server which is of .net 1.1. But checked it is retrieving value for that web.config correctly. Should i have to deply any other files and if not what can be the solution for this? Please help. Thanks, So...

use VB.NET and C#.NET code in the same C#.NET project
All-- Here is a sample that is "off the beaten path", (at least for me). Is it possible, in an ASP.NET application, using the code-behind page building technique, to have both pages written in VB.NET and pages written C#.NET?At http://www.WebLogicArts.com/DemoList.aspx there is a sample that shows that, (contrary to popular belief), it IS possible to mix ASP.NET pages built with C#.NET with ASP.NET pages built with VB.NET in the same VS.NET 2003 project. Note that this is just a "fun" sample to see if it can be done and I do not recommend this practice as a "standard" way of develo...

How to Create .mdb file from Excel file using C#.net
Hi all I want to create .mdb file that i have created excel feel from MS jet Database... through code behind Help me in this..  Regards RaviPlease click "mark as answer" if this post helped you. How to create an mdb file programmtically:http://support.microsoft.com/kb/317881How to import Excel data into it: http://www.mikesdotnetting.com/Article.aspx?ArticleID=79 Regards Mike [MVP - ASP/ASP.NET]My site...

Problem when get data from Excel file using ADO.NET
THIS IS MY CODE Private Sub GetDataFromXLS() Dim strConn As String Dim objConn As OleDbConnection Dim sql As String strConn = _ "Provider=Microsoft.Jet.OLEDB.4.0; " & _ "Data Source=C:\Data.xls;" & _ "Extended Properties=Excel 8.0;HDR=Yes;" objConn = New OleDbConnection(strConn) objConn.Open() sql = "SELECT ProductCode, ProductName FROM [Data$]" '-Data is name of sheet in Data.xls. Dim objComm...

Net:Net:Net::LDAP::FAQ
------_=_NextPart_001_01C6429F.D89AA417 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Hello, Net::LDAP Net::LDAPS Is there a possible to LDAP bind with an encrypted (SHA, SSHA, CRYPT, ....) password? I don't like to write the secret password to the perl file. Best regards Barbara Wilbert ------_=_NextPart_001_01C6429F.D89AA417-- Wilbert Barbara (CI/OSI) * wrote: > Hello, > > Net::LDAP > Net::LDAPS > > Is there a possible to LDAP bind with an encrypted (SHA, SSHA, CRYPT, > ......

converting to vb.net from c#.net authorize.net
authorize.net offered me some sample code when I signed up with them the only problem is the sample code is in c#.net but my page that they type all of their credit card into is vb.net <code><%@ Import Namespace="System.Net" %> <%@ Import Namespace="System.IO" %> <script language="C#" runat="server"> void Page_Load(Object Src, EventArgs E) { myPage.Text = readHtmlPage("https://certification.authorize.net/gateway/transact.dll"); } private String readHtmlPage(string url) { ...

Smart Device Application for file transfer to a remote server in .Net Compact Framework (Using Visual Studio.Net 2003,C# code)
Dear all, We are developing a smart device application (using C# code) for .Net Compact Framework where we need to write a programme in C# code to transfer a file from mobile device to remote server/machine.Can anyony help us regarding this aaplication.If you have already done this or you find any article/link regarding to this application then please let me know about that. My mail id : anirbandas.ju@gmail.com Looking forward for your reply soon. Regards Anirban   hi hav u got any solution , becoz i too need. plz share with me...

Pls Help Append Data/Image in an existing excel file using Vb.net
hi  I am using following code to write an graph image in an excel file .I want to write append this data/image in an existing excel file containing different report data.The below code doesn't work.If i use filemode.open instead of filemode.append then it writes in the file. what am i doing wrong is it something i m trying that is not possible or incorrect any advice will be helpfull.pls help me Thanks Shalin fs = New FileStream(Server.MapPath("TempExcel/test.xls"), FileMode.Create) fs.Write(bytes, 0, bytes.Length) fs.Close() fsRead = New FileStream(Server.MapPath("TempExcel/te...

use of vb.net and c#.net
i make a small website using vb.net,  in it i make a 2 class in C#.net. that i want to use in that website, i dont know how to call that class. let your class is  - class clsMyClass    {        public void myFunction()        {            // do something        }    } now the first way - create objectclsMyClass myObj = new clsMyClass();myObj.myFunction(); // call function================...

Visual C#.Net vs Visual Studio.Net
I have read in other posts a lot of people recommending Visual Studio.Net over the Web Matrix. My query is: why is there a £700 difference between VS.Net and Visual C#.Net? As a c# developer, I won't need any VB functionality. I also don't require Visual Source Safe, as projects are generally small and manageable. What features are lacking in Visual c#.net that justifies the price difference? Does it have Intellisense / Dubuggers / Compilers? These are the features that would make me pay for it instead of continuing with WM, but I need to know if tehre is serious functionality missin...

vb.net vs c#.net vs j#.net
just out of curiousity which looks, acts most like java? i'm still learning trying to used to vb.net but it seems that it was easier to do some stuff with java. C# is Java++ in my opinion. If you have done C or Jave you will prefer C#.Mike Schellenberger - MCAD If you are looking for language similar to java go for J#. However most code samples you find on the net will be in VB.NET and C#....

Converting windows application using web service from Visual C#.net 2003 to Visual Studio.net 2005
Hello, everyone! I have a solution which contains a windows project,a web service project and several other library projects. These projects were coded under visual c#.net 2003. Now I need to converted them to use Visual Studo.net 2005. Does any one know any article providing step-by-step guide  to converting WINDOWS APPLICATION with web service? I can find one under MSDN for converting web project.  But I guess I am a little confused if mine should follow this article since I am using web service in my windows application? Thanks a lot in advance.  ...

Aspose.Excel.Web 1.0 Released!
Aspose.Excel.Web 1.0 Released! Version 1.0 Released on March 10 2005 ...

Creating an Excel file using VB.Net
Just after some help to create an Excel file using VB.Net please. I've had a bit of a hunt around but can't find an exact example of code that I'm after. I'm new to .Net and VB.Net and wanted to create and save records to an EXCEL file. I can translate from C# if need be. Thanks for any help. Hi Amelia99, welcome to the forums. Which version of Excell do you want to use? The latest version (2003) has xml possibilities and you can download a free SDK at the microsoft site that makes it quite easy to use with vs.net 2003. It makes new project templates and one of them is for ex...

Web resources about - How to create and load data in to an excel worksheet of an existing excel file using ASP.NET, ADO.NET, and Visual C# .NET - asp.net.object-datasource

Worksheet - Wikipedia, the free encyclopedia
A worksheet is a sheet of paper, or on a computer, on which problems are worked A worksheet generator is a software program that generates problems, ...

Splash Math - 3rd grade worksheets for Addition, Subtraction, Multiplication, Division, Fractions & 11 ...
Get Splash Math - 3rd grade worksheets for Addition, Subtraction, Multiplication, Division, Fractions & 11 other chapters [HD Lite] on the App ...

Today’s Apps Gone Free: Walkathon, Doodle Jump HD, Montessori Worksheets And More
... Game Center. Doodle Jump HD is available for free today only (03/15). It has a 4.5-star rating with a total of 6727 ratings. Montessori Worksheets ...

School apologises over Bible and homosexuality worksheet
A Belfast school has apologised after complaints were made about a worksheet on religious views on homosexuality.

EPIC FAIL: Parents reveal insane Common Core worksheets
EPIC FAIL: Parents reveal insane Common Core worksheets

School worksheet tells kids GOP thinks helping poor 'waste of money,' parent claims
Tax season — and tax scams — are in full swing. Here are 3 common scenarios and what you should know to keep from becoming a victim.

Higher Education: School worksheet says GOP thinks poor are a waste of money
Apparently "fascist" was the wrong answer In case you were worried about the next generation and the future of the nation, save yourself some ...

Daughter Fails 'Gender Bias' Worksheet, Makes Dad Proud [PHOTO]
... assignment has generated impassioned debate online after her father, blogger Steve Bowler, sparked outrage by posting the third-grader’s worksheet, ...

Gender bias worksheet. I'm glad she failed. - Imgur
Imgur is used to share photos with social networks and online communities, and has the funniest pictures from all over the Internet.

Irish School Pulls Worksheet Claiming The Bible Says Homosexuals Don’t Get Into Heaven
An Irish college has pulled a worksheet from use, after the assignment spurred outrage over its portrayal of a specific Bible verse concerning ...

Resources last updated: 12/3/2015 1:07:14 PM