oledbcommand

Update specific cell of excel file using oledb

拟墨画扇 提交于 2019-12-20 06:42:53
问题 I want to update the specific cell of the excel file using oledb. Say I7 cell, for some reason always I1 is getting updated. Can anyone tell me what's wrong with this code? OleDbConnection oledbConn = new OleDbConnection(connString); oledbConn.Open(); // I want to set the value of I7 cell to 22, for some reason value is I1 is getting updated :( OleDbCommand cmd = new OleDbCommand("UPDATE [" + sheetName + "$I7:I7] SET F1=22", oledbConn); int result = cmd.ExecuteNonQuery(); Console.WriteLine

Error in executing an OleDbCommand.. “Must declare the scalar variable ”@MaxID“.”

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-19 09:59:20
问题 private void AddValue(string strValue) { //get the maximum id for Lists first int MaxID = DataOperations.ReturnMaxIDInATable("Lists", connString); int iSqlStatus = 0; string query = "INSERT INTO Lists(ID, ListName, ListValue) VALUES(@MaxID, @ListName, @ListValue)"; MaxID++; OleDbConnection dbConn = new OleDbConnection(connString); OleDbCommand dbComm = new OleDbCommand(); dbComm.Parameters.Clear(); try { dbComm.CommandText = query; dbComm.CommandType = CommandType.Text; OleDbParameter IDParam

Inserting MS Access Row Into Database using vb.net

萝らか妹 提交于 2019-12-18 09:14:34
问题 So im trying to add fields to a database. It is .mdb database, microsoft access. The Name of the table is Contacts. Dim con As New OleDb.OleDbConnection Dim dbProvider As String Dim dbSource As String Dim ds As New DataSet Dim da As OleDb.OleDbDataAdapter Dim sql As String dbProvider = "PROVIDER=Microsoft.Jet.OLEDB.4.0;" dbSource = "Data Source= C:\Users\Owner\Desktop\Contacts.mdb" con.ConnectionString = dbProvider & dbSource con.Open() sql = "INSERT INTO Contacts (FName, LName, Age, Address

Storing an image into an Attachment field in an Access database

时光毁灭记忆、已成空白 提交于 2019-12-17 04:07:28
问题 I'm writing a VB application where I need to store an image in the database. The user selects the image on their computer, which gives me the path as a string. Here's my attempt at it, however I'm getting the error "An INSERT INTO query cannot contain a multi-valued field." Here is my code: Dim buff As Byte() = Nothing Public Function ReadByteArrayFromFile(ByVal fileName As String) As Byte() Dim fs As New FileStream(fileName, FileMode.Open, FileAccess.Read) Dim br As New BinaryReader(fs) Dim

Updating Excel Sheet Using OleDb

孤人 提交于 2019-12-13 04:42:36
问题 I am trying to update a single cell of an Excel sheet. Note, in my example code below I am using variables for the column and row because this will change according to other parts of my program, but for debugging purposes I have set them to A and 1 respectively. Right now I am getting an error saying "Syntax error (missing operator) in query expression '06:31 PM'. Please don't simply suggest I parameterize because I know this will not fix my problem and I am not worried about injection.

No value given for one or more required parameters When all parameters are given

不问归期 提交于 2019-12-12 05:14:41
问题 The Error i get is An unhandled exception of type 'System.Data.OleDb.OleDbException' occurred in System.Data.dll Additional information: No value given for one or more required parameters. but this is when all parameters a present code bellow: private OleDbDataReader dbReader;// Data Reader object string sConnection = "Provider=Microsoft.ACE.OLEDB.12.0; Data Source=ICTSchool.accdb"; string sql; OleDbConnection dbConn = new OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0; Data Source

Syntax error (missing operator) in query expression, Oledb UPDATE Statement

折月煮酒 提交于 2019-12-11 08:26:52
问题 I'm a beginner at c# and I've tried looking through many posts to try and resolve my problem but I haven't had any luck, so I thought I may as well create a post to ask for your help. Basically,I'm trying to update an excel file with some extra info, but the problem is every-time I run the source code I keep getting this error: An unhandled exception of type 'System.Data.OleDb.OleDbException' occurred in System.Data.dll Additional information: Syntax error (missing operator) in query

How do I structure an OleDbCommand Query so that I can take Tables from one .MDB, and replace them in another .MDB

不想你离开。 提交于 2019-12-10 18:10:31
问题 I am trying to take tables from one Access Database File, add them to another Access Database file with the exact same structure but with different information. I need to overwrite any existing tables. I am almost done with my project this is last my brick wall. I am using a separate class file named DatabaseHandling.cs to work with the Access Database files. Here is my ENTIRE current DatabaseHandling.cs code. This is kept up to date for now on. Code: using System; using System.Collections

Quirky SELECT from Excel file via OleDbDataAdapter method (C#)

拟墨画扇 提交于 2019-12-10 10:38:02
问题 I have got an Excel file in this form : Column 1 Column 2 Column 3 data1 data2 data1 data2 data1 data2 data1 data2 data1 data2 data3 That is, the whole Column 3 is empty except for the last row. I am accessing the Excel file via OleDbDataAdapter, returning a DataTable: here's the code. query = "SELECT * FROM [" + query + "]"; objDT = new DataTable(); objCmdSQL = this.GetCommand(); objCmdSQL.CommandText = query; objSQLDad = new OleDbDataAdapter(objCmdSQL); objSQLDad.Fill(objDT); return objDT;

Alias parameters in SSIS

五迷三道 提交于 2019-12-08 16:45:37
问题 I am using an OLE DB command in SSIS for which the SQL command looks like this: UPDATE DBO.CLIENT SET TimeZoneID = ?, DaylightSavingTime = ?, ModifiedBy = ?, MicrosPropertyID = ?, IsOffline = ?, GlobalReporting_MaskPatronNumberType = ?, GlobalReporting_PatronNumberReadableCharacters = ?, GlobalReporting_MaskPrimaryCardType = ?, GlobalReporting_PrimaryCardReadableCharacters = ?, BICAddedDateTime = ?, BICUpdatedDateTime = ?, IsDBInDailyBoardRate = ? WHERE ClientID = ? When I try to do the