oledb

Reading Data using OLEDB from opened Excel File

て烟熏妆下的殇ゞ 提交于 2019-12-04 19:05:48
I have an excel file(Lets' say File X) with 2 sheets. In first sheet I display charts. Second I have data for the chart. In order to get data from chart, I need to process that data as we do in SQL like Group by, order by. Is there any way I can use oledb to read data from second sheet using VBA code in same excel file(file X)? Thanks!! Here's an example of using SQL to join data from two ranges: it will work fine if the file is open (as long as it has been saved, because you need a file path). Sub SqlJoin() Dim oConn As New ADODB.Connection Dim oRS As New ADODB.Recordset Dim sPath Dim sSQL As

Windows 8 OLEDB / ADO.NET drivers for Sybase ASE?

半腔热情 提交于 2019-12-04 15:50:37
Has anyone successfully installed Sybase OLEDB drivers and Sybase Central on a Windows 8 (64 bit) system? I've tried the installers on the Sybase website but they fail. Searches for "Windows 8" on the Sybase site and "Sybase Windows 8" on Google are bringing up nothing. We have a developer here who installed them on a Windows 7 system and then did an OS upgrade to Windows 8 so I know they will work. I would rather not uninstall Windows 8 and go that route if I can help it though. I managed to solve this! It seems like the actual GUI (written in Java) doesn't work in Windows 8, but there is a

Cannot register Sybase 15 ASE OLE DB driver on Windows 7

白昼怎懂夜的黑 提交于 2019-12-04 12:49:36
I am trying to get the Sybase 15 ASE OLE DB driver set up on my Windows 7 machine. I already have the Adaptive Server Enterprise driver listed in the Drivers tab of my 32-bit ODBC Data Source Administrator (C:\Windows\SysWOW64\odbcad32.exe). I tried to re-register the DLL with the command regsvr32 sybdrvoledb.dll and with C:\Windows\SysWOW64\regsvr32.exe sybdrvoledb.dll from a command prompt running as admin, and in both cases I get back "DllRegisterServer in sybdrvoledb.dll succeeded" but when I check in the ODBC administrator the driver is still not listed. Is there another way to get the

What is the best and fastest way to write into Excel file using C#?

坚强是说给别人听的谎言 提交于 2019-12-04 11:03:34
I am trying to write into excel file using OLEDB (without automation). I have around 500 rows of data which I get from some other application and then write into Excel file one by one using 'INSERT INTO..' Query. I am sure that there is no delay in reading data from the other application. I checked that. The total time taken to write into the excel file for 500 rows in around 3 minutes. This is too much. This is definitely because of the file write operation. What would be the best way to make this fast? Should I use some other technique for writing? Should I try a technique with automation?

I cannot open .xlsx file

蹲街弑〆低调 提交于 2019-12-04 10:29:26
I want to open an xlsx file, I have tried the below code,but neither does it open nor does it thrown any error. Can anyone throw any light upon it string path = "C:\\examples\\file1.xlsx"; string connString = string.Format("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + path + ";Extended Properties=\"Excel 12.0 Xml;HDR=YES\";"); OleDbConnection cn = new OleDbConnection(connString); cn.Open(); OleDbDataAdapter adapter = new OleDbDataAdapter("SELECT * FROM [Sheet1$]", cn); DataTable dt = new DataTable(); adapter.Fill(dt); Are you running it on 64 bit Windows? Last time I checked the OLE

Error: Number of query values and destination fields are not the same

霸气de小男生 提交于 2019-12-04 07:11:38
问题 Public Class RoomInfo Dim ValTx As String Dim ValNr As Integer Private Sub cboRoomType_DropDown(sender As System.Object, e As System.EventArgs) Handles cboRoomType.DropDown cboRoomType.Items.Clear() qry = "select RoomType from tblRoomType" cmd = New OleDb.OleDbCommand(qry, con) dr = cmd.ExecuteReader While dr.Read cboRoomType.Items.Add(dr("RoomType")) End While End Sub Private Sub cboRoomType_SelectValueChanged(sender As Object, e As System.EventArgs) Handles cboRoomType.SelectedValueChanged

Return value from OleDbCommand

北城余情 提交于 2019-12-04 06:58:37
sqlQuery = "SELECT [ID] from [users] WHERE CallerName=@CallerName"; OleDbConnection conn = new OleDbConnection(connectionString); conn.Open(); cmd = new OleDbCommand(sqlQuery, conn); cmd.CommandText = sqlQuery; cmd.Parameters.Add("@CallerName", OleDbType.VarChar).Value = labelProblemDate.Text.Trim(); cmd.Parameters["@CallerName"].Value = name; cmd.ExecuteNonQuery(); conn.Close(); I was told that this is how to read data from a SELECT query using Parameters but it's not working. I think I did something wrong. I am using WinForms and Microsoft Access 2007 It looks like you have your answer, but

getting the error: Query input must contain at least one table or query

只愿长相守 提交于 2019-12-04 05:13:46
问题 i get this error :Query input must contain at least one table or query my code is: using (OleDbConnection myCon = new OleDbConnection(@"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=timetabledata.accdb")){ OleDbCommand cmd = new OleDbCommand(); cmd.CommandType = CommandType.Text; string q = "INSERT INTO timehourly (teacherid,subjectid) Values ('@teacherID','@subjid')" + " WHERE hour='@i' AND dayid='@ds'"; cmd.Parameters.AddWithValue("@teacherID", Convert.ToInt32(teacher_combo.SelectedValue)

Oledb Update command

☆樱花仙子☆ 提交于 2019-12-04 04:11:39
问题 I make a program that saves and update a data from the database, I can save and read data, I can also update but the problem is, I can't select the "ID" as the index, here is my sample code using "ID" as the index, cmd = new OleDbCommand(); cmd.CommandType = CommandType.Text; cmd.CommandText = "UPDATE Records SET FirstName = @firstname, LastName = @lastname, Age = @age, Address = @address, Course = @course WHERE [ID] = @id"; cmd.Parameters.AddWithValue("@id", int.Parse(label7.Text)); cmd

VBA - Remove Password from OLEDB Connection String

一笑奈何 提交于 2019-12-04 03:50:02
I have an excel file that contains a series of OLEDB connections leveraged by several pivot tables. I would like to create a VBA function that removes all password from that several connection string as the file is closed(so that the users password will not be persisted). First I thought all I need to do was set the "Save Password" property to false, something like this: Public Sub RemovePasswordByNamePrefix() Dim cn As Object Dim oledbCn As OLEDBConnection For Each cn In ThisWorkbook.connections Set oledbCn = cn.OLEDBConnection oledbCn.SavePassword = False Next End Sub Should work right, on