473,386 Members | 1,766 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Exporting data to Excel cells

How can I update an existing excel file? I want to change certain values already present in the excel file and I am using


Expand|Select|Wrap|Line Numbers
  1.  
  2. Dim excelConnectionString As String = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Test.xlsx;Extended Properties=""Excel 12.0 Xml;HRD=No""" 
  3.         Dim excelConnection As New OleDbConnection(excelConnectionString) 
  4.         excelConnection.Open() 
  5. Dim strsql As String =  = "UPDATE [Sheet1$A3:A3] SET F1 = 'Test'" 
  6.  Dim cmd1 As New OleDbCommand(strsql, excelConnection) 
  7.             cmd1.ExecuteNonQuery() 
  8.             excelConnection.Close() 
  9.  
  10.  
It gives me the error saying that there is a requirement of one or more parameters. What should I do? Please help.
Feb 18 '11 #1
3 1275
MrMancunian
569 Expert 512MB
What line gives you the error? Have you tried searching the MSDN for the method you are using? Most of the times, all parameters (both mandatory and optional) are listed there.

Steven
Feb 21 '11 #2
This is the actual error
"No value given for one or more required parameters."

This line is giving error
cmd1.ExecuteNonQuery()

Expand|Select|Wrap|Line Numbers
  1. Dim excelConnectionString As String = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Test.xlsx;Extended Properties=""Excel 12.0 Xml;HRD=No"""  
  2.         Dim excelConnection As New OleDbConnection(excelConnectionString)  
  3.         excelConnection.Open()  
  4. Dim strsql As String = "UPDATE [Sheet1$A3:A3] SET F1 = 'Test'"  
  5.  Dim cmd1 As New OleDbCommand(strsql, excelConnection)  
  6.             cmd1.ExecuteNonQuery()  '<<<-----Error
  7.             excelConnection.Close()  
  8.  
  9.  
Feb 22 '11 #3
MrMancunian
569 Expert 512MB
Perhaps this link might help you: http://msdn.microsoft.com/en-us/libr...arameters.aspx

Steven
Feb 23 '11 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Chris | last post by:
Could someone please provide me an effective means of exporting data from a data set (or data grid) to Excel?
3
by: sridevi | last post by:
Hello How to export data from ms-access database to excel worksheet using ASP. mainly i need to export data to multiple worksheets. it is very urgent to us. i have a sample code which works...
2
by: deko | last post by:
I use a complied query to export to Excel like this: SELECT * INTO . FROM tblExcelData; But I have a situation where I need to export several tables into the same worksheet. The idea is to...
2
by: Mike P | last post by:
How do you go about exporting data in excel to a C# dataset? Any help would be really appreciated. Cheers, Mike
1
by: ad | last post by:
I use the code below to export the content of a data set to Excel, the code come form http://www.dotnetjohn.com/articles.aspx?articleid=36 But it always use the web form's name as the default...
2
by: pmud | last post by:
Hi, I am exporting data from an EDITABLE DATA GRID EXCEL. But the 1st column in data grid is Edit Column. I want to display all columns in Excel except for the Edit column. The following...
2
by: Rez | last post by:
Hi Guys, I have a problem with exporting to excel from a modal dialog box. Basically, i have an ASPX page that gathers user criteria, and passes it to a dialogbox (showModalDialog), There is a...
1
by: Mustufa Baig | last post by:
I have an ASP.NET website where I am showing off crystal reports to users by exporting them to pdf format. Following is the code: ---------------- 1 Private Sub ExportReport() 2 Dim oStream...
6
by: Opa | last post by:
Hi, I have a DataGrid, whose sourceI am exporting to Excel. This works fine except for the Column ordering. My datasource is not a datatable, with a typical SELECT statement where I can...
4
by: Tom | last post by:
I have a gridview on all of my web pages in my web app and they all export to excel. I have one page where the gridview is binding to a datatable that i created and only the first column is...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.