oledbconnection

Trouble with Insert Into .dbf file

℡╲_俬逩灬. 提交于 2019-12-11 06:44:14
问题 This code does not save any data in the dbf file. What is wrong here? Here is the code with the recommended changes. Thank you. string connectionString = @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\TEMP;Extended Properties=dBase IV"; using (OleDbConnection connection = new OleDbConnection(connectionString)) using (OleDbCommand command = connection.CreateCommand()) { connection.Open(); command.CommandText = @"CREATE TABLE TEST (Id Text, Changed Text, Tacos Text)"; command.ExecuteNonQuery

Get column names from excel file of a specific sheet using c# with OleDbConnection

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-11 02:28:31
问题 So far I have managed to get the column names of the whole excel file, but what I would like to do is to get the column names of the excel file of a given table (sheet). How could I modify the code to achieve this. I have been trying for a while now with no positive results, any help much appreciated. public static List<String> ReadSpecificTableColumns(string filePath, string sheetName) { var columnList = new List<string>(); try { var excelConnection = new OleDbConnection("provider=Microsoft

Excel file - It is already opened exclusively by another user,

给你一囗甜甜゛ 提交于 2019-12-10 21:58:30
问题 I am reading the excel file using C# and below is the code which is working as expected EXCEPT that every time i run the app, I have to close the excel file otherwise I get the below error message: The Microsoft Access database engine cannot open or write to the file ''. It is already opened exclusively by another user, or you need permission to view and write its data.. my question is: is there a way i close the excel file once i am done reading? public static DataTable LoadExcelWorkbook

Number of query values and destination fields are not the same error

北慕城南 提交于 2019-12-10 14:47:44
问题 I am getting an error while inserting data into a database. The error is: "Number of query values and destination fields are not the same". Insert code: OleDbConnection vconn = new OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\\Users\\Mutyyba\\Documents\\Database1.accdb"); vconn.Open(); string name = textBox1.Text; string address = textBox3.Text; int rollno = Convert.ToInt32(textBox2.Text); string vquery = "insert into Table1 values(@vname,@vrollno,@vaddress)";

Making a connection with MS Access

…衆ロ難τιáo~ 提交于 2019-12-10 14:22:30
问题 Microsoft.ACE.OLEDB.12.0' provider is not registered on the local machine. and Microsoft.JET.OLEDB.4.0' provider is not registered on the local machine. are both errors for me. I've been trying both while trying to create an Access connection. I'm not sure what to do anymore. I have 32 bit office on a 64 bit machine. I found solutions where they said to install the Access Database Engine but it won't let me install 64 bit with 32 bit office. Another source mentioned to bypass this you can go

How to set database name as a variable in SSIS?

北战南征 提交于 2019-12-10 13:35:31
问题 In my current project, the database name keeps changing and I do not want to modify my OLE DB Sources each time. Thus I want to set it as a variable. That is, in each OLE DB Source, I could use it as a parameter. However, it seems SSIS doesn't allow database name to be transferred as a parameter. So what should I do to minimize my changes? I wish to do something like this SQL statement in OLE DB Source: Select OrderID From ?.Order And I just need to modify my variable when the database name

Best way to check OleDbConnection state

点点圈 提交于 2019-12-10 12:45:30
问题 Apparently (MSDN) sometimes OleDbConnection.ResetState() does nothing, so even if the connection fails OleDbConnection.State will still be set to Open. I am looking for best workaround for this, so that when I check connection state I can avoid raising exceptions (as long as connection hasn't failed between the last check and usage attempt). Is there nothing better than sending a "useless" sql statement each time just to see if an exception is thrown? How do you make sure your connection is

Read using OleDbConnection created xlsx file using Open xml SDk

冷暖自知 提交于 2019-12-10 06:39:47
问题 I created xlsx file using standarts of Open Xml SDK. While opening it in excel everything works perfect. My problem is that I cannot open that created file using OleDbConnection, but others not created xlsx file OleDB can open as well. Will be glad for any help. 来源: https://stackoverflow.com/questions/29428208/read-using-oledbconnection-created-xlsx-file-using-open-xml-sdk

Excel reading in ASP.NET : Data not being read if column has different data formats

僤鯓⒐⒋嵵緔 提交于 2019-12-09 22:26:53
问题 I have an asp.net C# application where i am reading the contents of a spreadsheet using OLEDBConnection. I am using the below line of code to read from the excel spreadsheet. OleDbConnection con = new OleDbConnection(@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + fullFilePath + ";Extended Properties='Excel 8.0;HDR=Yes;IMEX=1'"); One of my column has data in various formats like strings,numbers,date etc in various rows.When running this ,When the data format is different,its not reading

Establish DB connection by using Microsoft OLE DB provider and SQL Native OLE DB provider

我的梦境 提交于 2019-12-09 03:44:11
问题 I have created a sample app by using both the oledb provider(SQLOLEDB and SQL Native OLEDB provider). Case 1 : Provider = SQLOLEDB hr = ::CoInitializeEx(NULL, COINIT_MULTITHREADED); hr = cADOConnection.CreateInstance(__uuidof(Connection)); CString con_string = "provider=SQLOLEDB;server=MYPC;Database=MyDB"; CString SSlcon_string = "provider=SQLOLEDB;Encrypt=true;TrustServerCertificate=true;server=MYPC;Database=MyDB"; CString userName = "sa"; CString Password = "sa"; BSTR bsConnection = /*con