oledbcommand

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 the stored procedure passing column values as the parameters and I usually use output paramt...

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

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...

Why am I getting this error when trying to update an Access Database file (.mdb) with a Datatable:

I've been working on my issue for 30 hours. Each time I fix one thing a new error arises. All I want to do is take a DataTables from memory and simply update an Access .MDB file. Here is my code: using System; using System.Collections.Generic; using System.Data; using System.Data.OleDb; using System.IO; using System.Linq; using System.T...

Custom writing OleDbCommand commands.

Hello! I have (another) question about writing OleDbCommand's. I have a complex select command (includes several left joins) and OleDbCommandBuilder is unable to generate update commands for me. I can't seem to grasp the magic behind writing update commands. I know the structure of the SQL update statement, however I am a bit puzzled a...

ssis : how to insert into oledb destination from oledb command

Hi I'm trying to insert in a ole db destination the result of a sp for each record in an ole db source, the sp returns a record set I have found this how to call a stored procedure in SSIS but i still can't see the outpout columns in OleDb Command Output Columns here is my sp: create PROCEDURE [dbo].[GetData] ( @user varc...

Stored Proc returns a Cursor, how to handle this using OLEDB in C#

Hello, 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 SP using the OLEDB data source. Any help on how to specify the SP is returning a cur...

How to use SQL user defined functions in .NET?

Hello 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 FROM [User] WHERE Username = @Username RETURN @UserId END Now I want to ru...

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 = ?, GlobalReporting_MaskPatronNumberType = ?, GlobalReporting_PatronNumberReadableCharacters = ?, GlobalReporting_M...

Retrieve SqlCommand/OleDbCommand query after inserting parameters?

Is there any way to access the prepared statement as sent to the SQL server? Dim params(1) As OleDb.OleDbParameter params(0) = New OleDb.OleDbParameter("@ID", OleDb.OleDbType.VarChar, 50) params(0).Value = guiItemsGridView.Rows(e.RowIndex).Cells("ID").Value params(1) = New OleDb.OleDbParam...

OleDbCommand can't excute this command, Why?

I create a table named "PathTable" in a MS-Access DB. The table is like this: ------------------------------ | IP | Input | Output | ------------------------------ | 127.0.0.1 | XXXXX | YYYYYY | ------------------------------ When I programed these String CommandString = "SELECT Input, Output FROM PathTable WHERE IP = '127.0.0...

Does the Microsoft SQL Server native client support IDBAsynchNotify?

I'm working on some OLE DB code that runs queries on MS SQL Server via ICommand::Execute. I'm converting this code to operate asynchronously by setting the DBPROPVAL_ASYNCH_INITIALIZE property on the command before executing. I'd prefer to register a IDBAsynchNotify sink so that my code can be notified of events, as opposed to polling o...

SQLCommand/SQLConnection vs OleDbCommand/OleDbConnection

Does it make a difference whether I use SQLCommand/SQLConnection instead of OleDbCommand/OleDbConnection. Do I get any advantages out of that, from a API-comfortability-, feature-, performance- or securitly perspective? Or any other perspective? ...

OleDbParameters and Parameter Names

Hi, 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 OleDbCommand(); Command.Connection = Connection; OleDbParameter Parameter1 = new OleDbParameter()...

Conversion from string to type 'Double' is not valid.

Hi, I am getting the following error while running a select statement (using OleDbCommand). My query is SELECT CME FROM Personnel WHERE CME = '11349D' If objOleDbCom.ExecuteScalar() > 0 Then When i execute the above statement i got this error Conversion from string "11349D" to type 'Double' is not valid. My field CME data t...

ADO.NET Command Classes - ExecuteNonQuery Method

I've heard that Microsoft accepts that the name of ExecuteNonQuery method of command classes was given inappropriate. Is there any official information about it, or it is just a rumour? ...

Execute multiple queries

I am using OleDB for executing my queries in C#, Is there any way I can execute multiple queries in one command statement? I tried to separate them with semi-colon (;) but it gives error "Characters found at the end" I have to execute a few hundreds of queries at once. Edit: I am executing Insert Statements. ...

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? ...

Opening an Excel file in c#

So there are a lot of questions regarding this method on SO, but none seem to answer my question. I firstly had an issue with the connectionstring (although it seems to work in other areas of my code correctly). This was resolved easily. Now the issue is with a simple SELECT query via a OLEDBCommand (Text) that keeps popping up the fol...

Data is not saved in MS Access database

Hello, I have a visual C# project and i'm trying to insert data in a MS Access Database when i press a button. Here is the code: private void button1_Click(object sender, EventArgs e) { try { OleDbDataAdapter adapter=new OleDbDataAdapter(); adapter.InsertCommand = new OleD...

Syntax error in INSERT INTO statement

conn = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=E:\\database.mdb"); conn.Open(); com = new OleDbCommand(@"insert into group (groupid,groupname,nature,effect) values (@groupid,@groupname,@nature,@effect)", conn); com.Parameters.AddWith...