Represents an SQL statement or stored procedure to execute against a data source using OLE DB provider.
Questions tagged [oledbcommand]
451 questions
24
votes
4 answers
Why does a LIKE query in Access not return any records?
Is there any reason why
SELECT * FROM MyTable WHERE [_Items] LIKE '*SPI*'
does not return any records with OleDbAdapter.Fill(DataSet) or OleDbCommand.ExecuteReader()?
When I run the same SQL in MS Access directly, it returns the expected records.…

Jake
- 11,273
- 21
- 90
- 147
21
votes
3 answers
Why the "Non" in "ExecuteNonQuery"?
I know this is not a hell of an useful question but I can't help being bugged by it.
So,
Why said method (in *Command classes) is called
ExecuteNonQuery instead of ExecuteQuery?
Aren't those SQL statements we throw at DBs, queries?

Camilo Martin
- 37,236
- 20
- 111
- 154
11
votes
2 answers
OleDbParameters and Parameter Names
I have an SQL statement that I'm executing through OleDb, the statement is something like this:
INSERT INTO mytable (name, dept) VALUES (@name, @dept);
I'm adding parameters to the OleDbCommand like this:
OleDbCommand Command = new…

Gaz
- 3,855
- 6
- 28
- 33
10
votes
4 answers
SSIS return value of Stored Procedure within an OLE DB Command
I am migrating data that has to be inserted using stored procedures which already exist. The stored procedures have parameters and a return value (from a select statement) of an id for the row inserted. Within an OLE DB Command in SSIS, I can call…

bobwah
- 2,454
- 4
- 33
- 49
10
votes
2 answers
How to use SQL user defined functions in .NET?
I created a scalar function in the DB
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER FUNCTION [dbo].[fn_GetUserId_Username]
(
@Username varchar(32)
)
RETURNS int
AS
BEGIN
DECLARE @UserId int
SELECT @UserId = UserId…

Shimmy Weitzhandler
- 101,809
- 122
- 424
- 632
8
votes
2 answers
Alias parameters in SSIS
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 = ?,
…

Raj More
- 47,048
- 33
- 131
- 198
6
votes
1 answer
Update a row in oracle using OLEDB command(SSIS)
I am trying to update some rows in an oracle Database, using an OLEDB Command
but whenever i try specifying the Sql Command this is what i get
An OLEDB record is available. Source: "OraOLEDB" Hresult:0x80040E51 Description:
"Provider cannot derive…

Brian Paul
- 651
- 2
- 12
- 21
5
votes
8 answers
insert into access database
i have trouble inserting data from textbox into ms access database, I get an error "Syntax error in INSERT INTO."
Can someone help me out please? here's the code:
public void button1_Click(object sender, EventArgs e)//save
{
using…

user2263271
- 101
- 1
- 1
- 5
5
votes
2 answers
Export into excel file without headers c# using Oledb
I'm using OleDB and I want to export my objects into excel table. Each row in the sheet will be one of my objects. The problem is that I don't know how to insert data when there's no column headers in the sheet.
This one:
commandString = "Insert…

Dimitar Tsonev
- 3,711
- 5
- 40
- 70
4
votes
3 answers
Is order of parameters for database Command object really important?
I was debugging a database operation code and I found that proper UPDATE was never happening though the code never failed as such. This is the code:
condb.Open();
OleDbCommand dbcom = new OleDbCommand("UPDATE Word SET…

nawfal
- 70,104
- 56
- 326
- 368
4
votes
1 answer
Two Inner Joins in OleDb SQL query
I'm trying to make an SQL query with an OleDbCommand into an Access database (.accdb).
While this command works fine (in a OleDbCommand.ExecuteReader()):
string command =
"SELECT cred.* " +
"FROM TB_CREDENTIALS cred " +
"INNER JOIN…

Daniel Möller
- 84,878
- 18
- 192
- 214
4
votes
1 answer
OleDbDataReader skips first record
I have the following code :
OleDbDataReader xlsReader =
new OleDbCommand("Select * from [" +spreadSheetName + "]", xlsFileConnection).
ExecuteReader();
In the spreadSheetName parameter i keep my file name.
The connection…

Vladyslav Furdak
- 1,765
- 2
- 22
- 46
4
votes
6 answers
Undefined function 'Replace' in expression , Replace alternative?
as read in this question : Undefined function 'Replace' in expression , I'm getting the error "Undefined function 'Replace' in expression" because "you aren't using the Access query engine at all", but what do I use as an alternative ? Apparantly…

Boyen
- 1,429
- 2
- 15
- 22
4
votes
2 answers
Unable to retrieve destination column descriptions from the parameters of the SQL command
I am trying to upgrade an SSIS package from 2008 to 2012 and getting the below error.
Error: SSIS Error Code DTS_E_OLEDBERROR. An OLE DB error has
occurred. Error code: 0x80004005.
An OLE DB record is available. Source: "Microsoft SQL Server…

hieu
- 63
- 1
- 6
3
votes
2 answers
Stored Proc returns a Cursor, how to handle this using OLEDB in C#
I am using OLEDB driver to call a Stored Procedure in Oracle DB.
The Stored Proc returns a cursor as the output.
I am able to call this Stored Proc using Oracle Data Source (System.Data.Oracle.OracleCommand), However I do not know how to call this…
bhiu