Similar Threads:
1.Getting XML via an OLEDB connection
Hi all.
I've a problem trying to get XML from SQL Server via an OleDb
Connection.
More precisely, the code does not work if the stored have the "FOR XML"
clause, otherwise works fine.
As you can see from the code, after the ExecuteReader, row by row
(while reading), I put the object array representing the fields into an
array of object.
The array will be parsed to return data back to the client in some
other format. As said, this code works fine if the stored are
"regular". When a stored returns XML (in UTF-16 Encoding) I'm able to
get the byte[] from the datareader into the usual object[], but I'm not
able to convert that byte array into the corresponding string. The
conversion does not work for UTF-16, UTF-8, ....
Any idea about that?
thanks and ciao
Antonio
Well, this is the code I'm using to get the data is:
OleDbConnection _DB = new OleDbConnection();
_DB.ConnectionString = strConnString;
_DB.Open();
OleDbCommand cmd = new OleDbCommand();
cmd.CommandType = CommandType.StoredProcedure;
cmd.CommandText ="sp_FORXML";
cmd.Connection = _DB;
//... add parameter here [...omissis...]
OleDbDataReader dr;
dr = cmd.ExecuteReader(cb);
int arrayindex;
arrayindex = 0;
while (dr.Read())
{
Row r = new Row();
object[] vals = new object[dr.FieldCount];
dr.GetValues(vals);
r._Fields = vals;
values.Insert(arrayindex++, r);
}
dr.Close();
_DB.Close();
Row[] aRowToRet = new Row[values.Count];
values.CopyTo(aRowToRet,0);
return aRowToRet;
2.Problem opening oledb connection to excel file
3.Bulk Import using Text file as input (OLEdb connection)
4.There must be a better way than this (oledb connections and connection strings)
Hi all,
I'm currently writing a windows-forms based application in C# using
visual studio express. It interfaces with an Access Database backend
and at the moment, I have a seperate connection for every function
(such as a button click) that I use. This means that at the moment, my
program is doing the following in a number of places:
1) On Form_Load, read the list of users from the database then close
the data connection
2) When the button is pushed to get the details of a specific user,
open the data connection (respecifying the variables including the
connection string), select the data and then close the connection
I'm from a PHP development background, so what I would like to do is
this:
1) Declare an application wide database connection object.
2) when any form is loaded, open the database object, do what you have
to do and close the connection.
3) if a button is clicked, open the same database object, do what you
need to do and close the object.
In the past (using PHP), I've declared the variable/object at the start
of the session and then just opened and closed it as needed. How do I
do this in C#?
Cheers,
Matt
5.OleDb connection to SQL connection
Hi,
I have an OleDb connection string to an SQL server provided by the Data Line
Properties dialog. What do I need to do to convert this OleDb connection to
an SQL connection.
Can I just remove the Provider property?
-Sam Matzen
6. Workgroup file information file error: OleDB to Access file
7. ADOMD.NET : connection string without xmla - No connection could b
8. ADOMD.NET : connection string without xmla - No connection cou