oledb

OleDB update command not changing data

ε祈祈猫儿з 提交于 2019-12-02 08:54:40
问题 I'm using Microsoft Access file as database. I have no problem with SELECT and INSERT queries but when I try to UPDATE , record in database does not change. Below is the code I use to run update. There are no exceptions or errors in debug log. cnn = new OleDbConnection(connetionString); OleDbCommand command = new OleDbCommand("UPDATE [Wpisy] SET [wpis]=@wpis, [id_kat]=@id_kat, [tytul]=@tytul WHERE [ID]=@id_wpis" , cnn); command.Parameters.Add(new OleDbParameter("@wpis", tresc_wpisu.Text));

Microsoft.ACE.OLEDB.12.0 driver for x64 app - how to make it work with x86 MS Office installed?

让人想犯罪 __ 提交于 2019-12-02 07:56:10
问题 Microsoft.ACE.OLEDB.12.0 driver is not working on my PC, I am trying to fix it. Error on connection opening is: "Provider cannot be found. It may not be properly installed." Here is what i got now: I have built x64 C# ADO.NET console application with connection string for connecting to '*.mdb': "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=..." I have two PC-s A and B, both have Windows 7 x64 and identical MS Office 2013 x86 version Same exacutable will run without problem on PC-A, and not

Failed to update in msAccess but successfully in dgv C#

大城市里の小女人 提交于 2019-12-02 07:42:26
This is my code for btnUpdate so that msAccess will update. private void btnUpdate_Click(object sender, EventArgs e) { string CoString=(@"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=H:\AccessDatabase.accdb"); OleDbConnection con = new OleDbConnection(CoString); string Update ="Select * from StudentDb"; DataSet ds = new DataSet(); DataSet changes; OleDbCommandBuilder cbuild = new OleDbCommandBuilder(); try { con.Open(); OleDbDataAdapter da = new OleDbDataAdapter(Update, con); da.Fill(ds); cbuild = new OleDbCommandBuilder(da); changes = ds.GetChanges(); if (changes != null) { da.Update(ds

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

女生的网名这么多〃 提交于 2019-12-02 07:26:10
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).ToString()); cmd.Parameters.AddWithValue("@subjid", Convert.ToInt32(subject_combo.SelectedValue)

Trouble with INSERT INTO statement

拈花ヽ惹草 提交于 2019-12-02 07:25:37
I can't seem to figure out why I keep getting a Syntax error in INSERT INTO statement . The code is below. static void ABSChangeEventsTable(string ControlNumber, string CurrentStatus) { using (var connection = new OleDbConnection(strAccessConnAbstracting)) using (var command = connection.CreateCommand()) { connection.Open(); command.CommandText = "INSERT INTO Events (Date_Time, Details, Regarding, User, Control_Number) VALUES (@Date_Time, @Details, @Regarding, @User, @Control_Number)"; command.Parameters.AddWithValue("@Date_Time", DateTime.Now); command.Parameters.AddWithValue("@Details", "OLD

Get column name from excel worksheet

回眸只為那壹抹淺笑 提交于 2019-12-02 07:13:10
In C#, how do I get the column name from a worksheet in an Excel file? Here is my code so far: ConnectionString = string.Format("Provider=Microsoft.ACE.OLEDB.12.0;Data Source={0};Extended Properties=\"Excel 12.0 Xml;HDR=YES;IMEX=1\";", "@"C:\file.xlsx"); objConn.Open(); OleDbCommand objCmdSelect = new OleDbCommand("SELECT * FROM ["xlWorksheet"$]", objConn); OleDbDataAdapter objAdapter1 = new OleDbDataAdapter(); objAdapter1.SelectCommand = objCmdSelect; DataSet objDataset1 = new DataSet(); objAdapter1.Fill(objDataset1); objConn.Close(); Does you connection string include the HDR=YES ?: Provider

Missing column of Dates in CSV file using Schema.ini file

喜欢而已 提交于 2019-12-02 07:01:28
Note: answering my own problem to help others in future. I'm reading a CSV file with OleDB: DataTable csvTableSchema = new DataTable(); //Open the CSV string csvFilePath = "C:\\temp\\WithDateColumn.csv"; var connString = string.Format( @"Provider=Microsoft.Jet.OleDb.4.0; Data Source={0};Extended Properties=""Text;HDR=YES;FMT=Delimited""", Path.GetDirectoryName(csvFilePath) ); //To read the csv with DataTypes we specify the columns and their datatypes in the Schema.ini //REF https://docs.microsoft.com/en-us/sql/odbc/microsoft/schema-ini-file-text-file-driver using (var conn = new

Convert Null to zero in access database

旧时模样 提交于 2019-12-02 06:56:37
Considering that Grade.firstExam, Grade.secondExam, and Grade.finalExam are all TEXT and not numbers , i can't get the exact solution to convert null values into Zeros. I already tried to use NZ() but it returns an error message (Undefined Function 'NZ' in expression) im using VB.net with MS Access as my database. i also imported System.Data.OleDb Namespace. SQLStatement = " SELECT Student.idNumber as 'IDno', " SQLStatement &= " Student.lastName + ', ' + Student.firstName as 'FullName', " SQLStatement &= " Grade.firstExam as 'firstExam', " SQLStatement &= " Grade.secondExam as 'secondExam', "

How to change Crystal Reports connection string using OLE DB in vb.net?

孤者浪人 提交于 2019-12-02 06:45:41
问题 i have a "Connection.vb" where all my Connection string stored and used by the entire program. i'm new to Crystal Reports.. and i want to changes its connection string based on the connection string i made... im using MS SQL 2008.. SQL Server Native Client 10.0 OLE DB Provider.. and here is my connection string. "Provider=SQLNCLI10;Server=....\SQLEXPRESS;Database=Blah;Trusted_Connection=yes" i tried to google it.. but they are using different language, different database, and complex examples

C# extract formatted text from Excel through OLEDB

♀尐吖头ヾ 提交于 2019-12-02 06:44:11
问题 I am reading data from a large excel file which has got formatted texts. I extract the data to DataTable object through oleDBConnection & GetOleDbSchemaTable . But the extracted data doesn't include any formatted information. My requirement is, I need to extract only non-Strikethrough texts. I don't have any issues while reading and everything is perfectly fine. But my extraction should be based on text format in excel which I am unable to find the solution. Anything to be added in the