473,394 Members | 1,944 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,394 software developers and data experts.

why it works in vb butnot in c#...

in vb.net

Dim cn As New ADODB.Connection
cn.Open("Provider=SQLOLEDB;Data Source=SYS13\CALLZONE;" & _
"Initial Catalog=importeddata;User ID=sa;Password=")

'Import by using OPENROWSET and SELECT query.
Dim strSQL As String = "SELECT * INTO " & fname & " FROM OPENROWSET('Microsoft.Jet.OLEDB.4.0', " & _
"'Excel 8.0;Database=" & fpath & "'," & _
"'SELECT * FROM [sheet1$]')"

cn.Execute(strSQL)
cn.Close()
cn = Nothing



in c#.net
\======
ADODB.Connection cn=new ADODB.Connection();
cn.Open(@"Provider=SQLOLEDB;Data Source=SYS13\CALLZONE;" +
"Initial Catalog=importeddata;User Id=sa;Password=;");

//Import by using OPENROWSET and SELECT query.
string strsql = @"SELECT * INTO Table1_Xls FROM "+
"OPENROWSET('Microsoft.Jet.OLEDB.4.0'," +
"'Excel 8.0;Database="+ fpath +"','SELECT * FROM [sheet1$]')";
cn.Execute(strsql);

cn.Close();
cn = null;


reply me as soon as possible
Jul 12 '07 #1
2 1414
it shows error in c# that

no overload for method open takes 1 arguments
no overload for method execute takes 1 arguments
Jul 12 '07 #2
r035198x
13,262 8TB
it shows error in c# that

no overload for method open takes 1 arguments
no overload for method execute takes 1 arguments
Please do not ask questions in the articles section.
Jul 12 '07 #3

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

Similar topics

0
by: Puneet Jain | last post by:
I am tryin to use Microsoft Works Wordprocessor from Python After generating the .py module from the type library using makepy utility, I runt he following commands, >>> from win32com.client...
1
by: Gerd Güldenast | last post by:
Hi, I am having a problem with a replication over a Modem-Connection, which works fine over LAN. Has anyone experienced this problem before? Settings are: 2 SQL Servers 2000, SP3 on Windows...
10
by: tony kulik | last post by:
This code works fine in ie and opera but not at all in Mozilla. Anybody got a clue as to how to get it right? <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <script...
1
by: Moi | last post by:
I have tried repeatedly to import a MS Works database (simple address database) into Access, but I am having little luck. I have saved the Works file as DbaseIII DbaseIV and neither is seen by the...
2
by: Enrique Bustamante | last post by:
Casting arrays that works on watch and command window but not in code. My application is casting arrays in a way it should work. To test if I was doing something invalid, I wrote a test code that...
4
by: puja | last post by:
hi all, I have an asp.net website where am including .css file dynamically on page load event. For diff users, there is diff CSS file. So after user logs in, I am setting CSS href on page load....
0
by: patmg | last post by:
Hello, We use a SQL Server database to manage accounts in AD via a COM object using ADSI written in VB6. I have to move this database to a new server. The only real difference between the two...
3
by: Miro | last post by:
First off...thanks in advance for getting me this far. Sorry for all these class posts but im having a heck of a time here trying to get something to work, and have finally got it to work (...
6
by: nild | last post by:
Hello i have a strange problem. I'm using LogonUser to impersonate the user under which my program must run. On Win XP or Server 2003 it works. But on 2000 it doesn't. So i found out, to set...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.