I'm trying to pull some binary data from a database and write them to pdf files. For the most part, this is going along swimmingly, but the occasional row of data seems to throw a particular error -
Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding.
Keep in mind, this onl...
Hi all,
Well, i am tring to do something nice (nice for me, simple for you guys), i was told i can do it, but i have no idea where to start.
I have two DDL's in a page, i need on page_load to popolate both, each one gets data from deferent table with no relaition between them (suppliers/catagories). i know how to do it with two DB conne...
I'm using a SQLdatareader to build POCOs from a database. The code works except when it encounters a null value in the database. For example, if the FirstName column in the database contains a null value, an exception is thrown.
employee.FirstName = sqlreader.GetString(indexFirstName);
What is the best way to handle null values in th...
Hi everyone, can you explain me why I can't use two datareader in on procedure?
Here is the sample code:
Private Sub Do_Execute()
Dim conx as SqlConnection
Dim cmd1 as SqlCommand
Dim cmd2 as SqlCommand
Dim drd1 as SqlDataReader
Dim drd2 as SqlDataReader
conx = new SqlConnection("connection string")
conx.Open()
c...
I am suing SqlDataReader to read data from SQL Server. However sometimes I want to cache my data in memory as read only lightweight connection free object. I couldn't find any options for me in the BCL. Do I need to write my own implementation of such container, or are any available?
What alternatives do I have for storing data from dat...
Hi All, Again I have problem with checking whether DataReader object has data or not?
Dim cmd as SqlCommand
Dim drd as SqlDataReader
cmd = New SqlCommand ("SELECT * FROM Stock", conx)
drd = cmd.ExecuteReader()
''HERE I WOULD LIKE TO CHECK WHETHER drd has Data or not
While (drd.Read())
{
txtName....
I've never tried this - so I don't know if I'd run into memory issues.
But can a SqlDataReader read a trillion records? It's all streamed correct? I'm a little green to what the SQL/TDS protocol is doing under the covers.
UPDATE
Translate Trillion to mean very large number. I probably should have said something like 1 billion or 100 mi...
Hello,
I'm looking for a workaround, my destination server (Rainingdata D3) is returning an error when my reader is returning to much lines.
explications:
1 datareader reads from my sqlite database,
2 via a while reader-loop i'm inserting in the destination database (ODBC- D3 database)
i don't have a other solution oder other dataprov...
As a part of trying to repair stuff in a fairly messed up legacy system I have a method making a call to a stored procedure in our SQLServer database. Nothing in this set up is ideal, but it is what I have got to work with. The two options I have is to use a SqlDataReader to read the stream as rows from the database, or to be handed the ...
I have a table containing two columns in SQL that I want to extract values from. The problem though is I do not know how to retrieve column 2's values in C# code. I am using SQL Server 2008 and VS. Do I have to use an OUTPUT parameter in the SP? If so, how would I specify this SP? I have experimented with OUTPUT parameters, but I am...
If i do a select on user.name, user.post, t.name with t being tag_name AS t is there a way to resolve the full name using ADO.NET?
I found SqlDataReader.GetName but that is getting me only name as the first result. I would like to know if it belongs to user or tag_name. Is there a way to have it tell me?
...
I have a method ("GetDataReader," let's call it) that returns a SqlDataReader. It's inside a Singleton DataFactory class that maintains a persistent connection to the database.
The problem with this is that after being returned, the DataReader is still "connected" to the Connection object in my DataFactory. So, I have to make sure the...
I'm trying to implement a method which will take a given connection string and return an ArrayList containing the contents of a SQL view.
I've verified the validity of the connection string and the view itself. However I don't see what the problem is in the code below. In debug, when it runs the ExecuteReader method and then try to ente...
Hi,
I am creating an automated DB Query Execution Queue, which essentially means I am creating a Queue of SQL Queries, that are executed one by one.
Queries are executed using code similar to the following:
using (SqlConnection cn = new SqlConnection(ConfigurationManager.ConnectionStrings["NorthwindConnectionString"].ConnectionString)...
First, let me explain the current situation: I'm reading records from a database and putting them in an object for later use; today a question about the database type to C# type conversion (casting?) arose.
Let's see an example:
namespace Test
{
using System;
using System.Data;
using System.Data.SqlClient;
public enum ...
I am new to this and had this question. Can i use SQLDataReader instead of a Recordset. I want to achieve the following result in an SQLDataReader.
Dim dbConn As New ADODB.Connection
Dim rs As New ADODB.Recordset
Dim sqlstr As String = "SELECT Name,Status FROM table1 WHERE id=" + item_id.Value.ToString
rs.Open(SQL, dbConn)
While Not rs....
I have the below code :
if (reader.HasRows)
{
while (reader.Read())
{
DataRow searchedDR = ds.Tables[dr["name"].ToString()].Rows.Find(reader["ID"].ToString());
if (searchedDR != null)
ds.Tables[dr["name"].ToString()].Rows.Remove(searchedDR);
}
}
When this block of code done successfully the data...
I'm using SqlBulkCopy to bulk insert some records from one table into another table. The query is using a SqlDataReader to get the data. The one difference that matters (besides column order which is handled in the mappings) between the tables is that the destination table has a date column into which the current date needs to be added...
Some tables I am dealing with have null values and are throwing errors. So far ive tried a few solutions to deal with the nulls with no success.
Here are the code samples from my efforts so far;
If (r("datemodified").Equals(DBNull.Value)) Then
datemodified = String.Empty
Else
datemodified = (...
what's better
var s = (string)reader[0]
or
var s = Convert.ToString(reader[0])
?
...