ado.net

Dapper & Oracle Clob type

余生颓废 提交于 2020-01-02 02:55:31
问题 I am using dapper to do some oracle access. I have a scenario where I have to have an output parameter with a type of OracleDbType.Clob. As I am using dapper and thus using the base DbType enumeration I am using the DbType.Object enum as suggested here http://docs.oracle.com/html/B14164_01/featOraCommand.htm to stand in for OracleDbType.Clob. However, this sets the command parameter (deep down in dapper) to be of DbType object and oracle type Blob (as the DbConnection providers a concrete

await/async Microsoft Practices Enterprise Library Data

 ̄綄美尐妖づ 提交于 2020-01-02 02:46:07
问题 I have an older application that I wrote where I used Microsoft.Practices.EnterpriseLibrary.Data to get data from the DB. I have recently upgraded to .NET 4.5 and wanted to advantage of await/async . I do not see any methods ending in "Async" as per the naming standard, even in the most recent version of the package. Is it possible to use await/async with this ADO .NET library without manually making it asynchronous? 回答1: I'm using an older version of the EL that offers Begin* / End* methods,

Best way to set strongly typed dataset connection string at runtime?

早过忘川 提交于 2020-01-02 01:01:07
问题 My Windows Forms application uses a strongly typed dataset created using the designer in Visual Studio. At runtime I would like to be able to select either the live or test database. What is the best way to programmatically set the connection string for the dataset at runtime? 回答1: Connection property in TableAdapters is defined as internal . internal global::System.Data.SqlClient.SqlConnection Connection So in case your TypedDataset is not in the same assembly as your main windows forms app,

Connection string for Informix for .NET

亡梦爱人 提交于 2020-01-01 19:17:49
问题 We are using an Informix database, and are connecting to it from .NET sucessfully using ODBC. The connection string we are using is; DRIVER={IBM INFORMIX ODBC RIVER}; UID=username; PWD=password; DATABASE=our_database; HOST=devsrv01; SERVER=devsrv01_tcp; SERVICE=ids9tcp2; PROTOCOL=onsoctcp; CLIENT_LOCALE=en_US.CP1252; DB_LOCALE=en_US.819; We want to change from ODBC and use IBM's SDK and libraries as outlined on their site. The code we are using is; string ConnectionString = "Database=our

Connection string for Informix for .NET

时光总嘲笑我的痴心妄想 提交于 2020-01-01 19:17:11
问题 We are using an Informix database, and are connecting to it from .NET sucessfully using ODBC. The connection string we are using is; DRIVER={IBM INFORMIX ODBC RIVER}; UID=username; PWD=password; DATABASE=our_database; HOST=devsrv01; SERVER=devsrv01_tcp; SERVICE=ids9tcp2; PROTOCOL=onsoctcp; CLIENT_LOCALE=en_US.CP1252; DB_LOCALE=en_US.819; We want to change from ODBC and use IBM's SDK and libraries as outlined on their site. The code we are using is; string ConnectionString = "Database=our

Running out of connections in pool

牧云@^-^@ 提交于 2020-01-01 19:11:23
问题 I have a web forms app that will display a list of records in a GridView and by checking multiple checkboxes you can mass delete the records. The code itself is straightforward: protected void btnDelete_Click(object sender, EventArgs e) { int i = 0; try { foreach (GridViewRow row in GridView1.Rows) { CheckBox cb = (CheckBox)row.FindControl("ID"); if (cb != null && cb.Checked) { int profileID = Convert.ToInt32(GridView1.DataKeys[row.RowIndex].Value); Profile profile = new Profile(profileID); /

Running out of connections in pool

陌路散爱 提交于 2020-01-01 19:11:13
问题 I have a web forms app that will display a list of records in a GridView and by checking multiple checkboxes you can mass delete the records. The code itself is straightforward: protected void btnDelete_Click(object sender, EventArgs e) { int i = 0; try { foreach (GridViewRow row in GridView1.Rows) { CheckBox cb = (CheckBox)row.FindControl("ID"); if (cb != null && cb.Checked) { int profileID = Convert.ToInt32(GridView1.DataKeys[row.RowIndex].Value); Profile profile = new Profile(profileID); /

How to figure out which SQLDependency triggered change function?

冷暖自知 提交于 2020-01-01 17:26:08
问题 I'm exploring query notifications with the SQLDependency class. Building a simple working example is easy, but I feel like I'm missing something. Once I step past a simple one-table/one-dependency example I'm left wondering how can I figure out which dependency triggered my callback? I'm having a bit of trouble explaining, so I included the simple example below. When AChange() is called I cannot look at the sql inside the dependency, and i don't have a reference to the associated cache object

How can I read multiple tables into a dataset?

帅比萌擦擦* 提交于 2020-01-01 11:47:09
问题 I have a stored procedure that returns multiple tables. How can I execute and read both tables? I have something like this: SqlConnection conn = new SqlConnection(CONNECTION_STRING); SqlCommand cmd = new SqlCommand("sp_mult_tables",conn); cmd.CommandType = CommandType.StoredProcedure); IDataReader rdr = cmd.ExecuteReader(); I'm not sure how to read it...whats the best way to handle this type of query, I am guessing I should read the data into a DataSet? How is the best way to do this? Thanks.

how to close connection/datareader when using SqlDataSource or ObjectDataSource

我的未来我决定 提交于 2020-01-01 09:45:45
问题 during beta testing we discovered connection pooling error messages . Therefore I have been going through the code and closing down the SqlDataReader objects wherever they have been left unclosed. What I need to know is how to close a datareader (or if there is a need at all to close) that is specified in the SelectStatement attribute of the SqlDataSource or ObjectDataSource tags. Could there be connection leak if they are not handled? Thanks in advance ! 回答1: I tend to use the "using"