Represents an SQL statement or stored procedure to execute against a data source using OLE DB provider.
Questions tagged [oledbcommand]
417 questions
23
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
- 10,633
- 20
- 79
- 134
20
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
- 34,128
- 20
- 104
- 150
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,455
- 5
- 23
- 33
9
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,232
- 4
- 30
- 44
9
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
- 92,920
- 119
- 388
- 596
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
- 44,313
- 31
- 123
- 191
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
- 641
- 2
- 10
- 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
- 91
- 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,334
- 5
- 37
- 67
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
- 62,042
- 48
- 302
- 339
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…
Vladislav Furdak
- 1,485
- 1
- 17
- 40
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,099
- 1
- 9
- 21
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
3
votes
4 answers
Error in executing an OleDbCommand.. "Must declare the scalar variable "@MaxID"."
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,…
Rej Maranan
- 27
- 1
- 2
3
votes
1 answer
Which SSIS executable is best practise to use for delete command
I have 2 DB's on same SQL 2016 std. server. I need to delete Prod table data that matches ID's in the Arh DB table. I am doing this in batches of 10000 rows.
Table's on Prod and Arh DB are with same schema.
I need to delete a large amount of data…
Aleksandar
- 55
- 7