oledb

Calculated column in wrong position when using `SELECT *`

旧街凉风 提交于 2019-12-08 04:11:15
Consider this query that uses SELECT * and 'appends' a calculated column: SELECT *, IIF(TRUE, 1, 0) AS calculated_col FROM Orders; I would expect calculated_col to be the rightmost column in the resultset. However, it is in fact the leftmost column. It is the rightmost when executing the equivalent query in SQL Server, for example. Now, because this is Access (ACE, Jet, whatever), the SQL Standards don't apply and the Access Help will not specify the expected result because it is not detailed enough (to put it politely). So my questions are: Does Access always behaved this way or is it a

VBA - How to Clear a Connection String From a Connection

泄露秘密 提交于 2019-12-08 03:29:58
问题 I have a function that attempts to clear every connection string from every connection, it works as follows: Public Sub RemovePasswordByNamePrefix() Dim w As Worksheet Dim qt As QueryTable Dim cn As Object Dim odbcCn As ODBCConnection Dim oledbCn As OLEDBConnection For Each cn In ThisWorkbook.connections If cn.Type = xlConnectionTypeODBC Then Set odbcCn = cn.ODBCConnection odbcCn.SavePassword = False odbcCn.connection = "" odbcCn.CommandText = "" ElseIf cn.Type = xlConnectionTypeOLEDB Then

“Cannot open a database created with a previous version of your application” shows when VB.NET program tried to open a MDB file using OleDBConnection

纵饮孤独 提交于 2019-12-08 02:56:24
问题 I have created a software using VB.NET in a 32-bit Windows 7 OS. It contains those line of codes below: Dim cn As New OleDbConnection cn.ConnectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" & fileNameStr & ";Jet OLEDB:Database Password=xxxxxxx" cn.Open() The codes open a MDB file (Microsoft Access file) protected by a password. When I run the software in my computer, it works well. However, when it is tested in another computer, an error message appears saying "Cannot open a

Why is OleDB ignoring Excel cells?

吃可爱长大的小学妹 提交于 2019-12-08 02:20:18
问题 Here's the setup: I have an excel spreadsheet that has a very simple page. It looks like so: I use the following connection string to access this file: string.Format("Provider=Microsoft.ACE.OLEDB.12.0;Data Source={0};Extended Properties=\"Excel 8.0;HDR=NO\";", fn) My function to access the file looks like: try { string select = string.Format("SELECT * FROM [{0}$]", tab.PageName); OleDbDataAdapter adapter = new OleDbDataAdapter(select, con); DataSet ds = new DataSet(); adapter.Fill(ds, tab

Adding data in the database using microsoft access and OleDb in C#

给你一囗甜甜゛ 提交于 2019-12-07 22:56:33
问题 I am new to OleDb library and I want to add a text form text box into a database with this library. My code: public partial class Form1 : Form { public Form1() { InitializeComponent(); } private OleDbConnection conn = new OleDbConnection(); private void button1_Click(object sender, EventArgs e) { conn.ConnectionString = @"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=D:\Project\Learning\Visual C#\Form\WindowsFormsApplication1\WindowsFormsApplication1\Test.mdb"; string NAME = textBox1.Text;

DataColumn's AutoIncrement Returns False Always

谁说胖子不能爱 提交于 2019-12-07 18:56:56
问题 I am interested to check out whether column has an autoincrement/allowdbnull property . Having this code below , gives me always false although I already have one column that has autoincrement/allowdbnull property. Dim dt As New DataTable() Dim con As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source =" & Application.StartupPath & "\test.mdb" Dim sql As String = "SELECT * from teachers" Dim i As Integer Dim dataAdapter As New OleDb.OleDbDataAdapter(sql, con) dataAdapter.Fill(dt)

OLEDB with updating excel cells

亡梦爱人 提交于 2019-12-07 18:19:56
问题 I wrote this method to update an excel cell: public void update(string fileName, string sheetName) { string connString = connString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + Server.MapPath(fileName) + ";Extended Properties=Excel 12.0"; try { OleDbConnection oledbConn = new OleDbConnection(connString); oledbConn.Open(); OleDbCommand cmd = new OleDbCommand("UPDATE ["+sheetName+"$B5:B5] SET F1=17", oledbConn); cmd.ExecuteNonQuery(); oledbConn.Close(); } catch(Exception ex) { Debug

How to check if a client has SQLNCLI10 provider installed when browsing?

你说的曾经没有我的故事 提交于 2019-12-07 16:42:43
问题 I have a c# website that allows a client to connect directly to a remote SQL Server database from their PC , bypassing the web server, by using a 3rd party ActiveX control. I was originally using the SQLOLEDB provider and it was working fine. The clients are in an internal network (using Windows machines and Internet Explorer) and the website is not intended for exposure to the general internet. I had to upgrade from using the SQLOLEDB provider to the SQLNCLI10 provider to cater for the new

C# and Oracle database connection

岁酱吖の 提交于 2019-12-07 15:34:29
Hello i have a project which the developer uses conn1 = new OleDbConnection("Provider=MSDAORA; Data Source=example;User ID=test;Password=test;Unicode=True"); conn1.Open(); I have problem with that provider MSDAORA and i think it's old So i want to Connect to my database with another easy solution without MSDAORA. Thank you Aghilas Yakoub Try with Oracle provider, add reference to System.Data.OracleClient assembly use OracleConnection as in this example string connectionString = "..."; using (OracleConnection connection = new OracleConnection(connectionString)) { connection.Open(); using

How to Open a CSV or XLS with Jet OLEDB and attain Table Lock?

↘锁芯ラ 提交于 2019-12-07 15:22:27
问题 I am trying to figure out how to read/write lock a CSV or XLS file when I read it as a Database via Jet OLEDB. The following code will open a CSV as a DB and load it into a DataTable object: private DataTable OpenCSVasDB(string fullFileName) { string file = Path.GetFileName(fullFileName); string dir = Path.GetDirectoryName(fullFileName); string cStr = "Provider=Microsoft.Jet.OLEDB.4.0;" + "Data Source=\"" + dir + "\\\";" + "Extended Properties=\"text;HDR=Yes;FMT=Delimited\";"; string sqlStr =