datareader

Using datareaders with sqltransactions

删除回忆录丶 提交于 2020-02-02 12:59:05
问题 I am using SqlTransaction s in my code for roll back purpose. Within the transaction I got multiple statements to be executed with may include selects inserts and updates. All these statements are within the scope of the sqltransaction . Everything works fine just for one problem. I am using datareader s for select statements . And these readers are closed once they are used. This forces the connection to be lost and every thing fails. Does any one have a solution on whether I can use

MysqlException was unhandled DataReader with this connection must be closed vb.net

可紊 提交于 2020-01-25 07:08:07
问题 I have encountered this problem: ERROR: There is already an open DataReader associated with this Connection which must be closed first. Please have a look on my code: Dim sqlQuery As String = "SELECT * FROM users" Dim myAdapter As New MySqlDataAdapter If txtUsername.Text = String.Empty And txtPassword.Text = String.Empty Then MsgBox("Enter username and password", MsgBoxStyle.Exclamation, "Tea Sparkle POS") Else Dim sqlquerry = "Select * From users where username = '" + txtUsername.Text + "'

Invalid attempt to call MetaData when reader is closed?

▼魔方 西西 提交于 2020-01-24 04:23:06
问题 I'm running an if else statement off of a datareader to query table data and activate/de-activate some controls on a page. I implemented a using statement to automatically close the connection and the reader when I close the block, but I still get the reader is closed error on each of my if else statements. What's missing? Code below: string comnt = "SELECT StatusId FROM Submission WHERE SubmissionId =" + x; using (SqlConnection editConn = new SqlConnection(connectionString)) { editConn.Open(

I keep getting this error: “Invalid attempt to call Read when reader is closed”

落花浮王杯 提交于 2020-01-22 03:26:06
问题 Here is my code, I close and open the reader and it's still not working. A few threads can access this function concurrently but there is a lock. It works a few times in the beginning but sooner or later I get the exception 'Invalid attempt to call Read when reader is closed' at private IList<BursaUser> GetUsers(SqlCommand cmd) { IList<User> users = new List<User>(); User user; lock (thisLock) { SqlDataReader dr = null; try { Conn.Open(); dr = cmd.ExecuteReader(CommandBehavior.CloseConnection

DataReader does not see data in Excel cell if previous cell in the column are empty

不打扰是莪最后的温柔 提交于 2020-01-16 10:15:45
问题 I have a weird problem with reading .xls file using OleDbDataReader . Basically, it does not see a data in the cell, if the previous cells in the column are empty. If I move the row with the data at the top of Excel sheet, then everything loads fine. I'm not sure, but I think that it has something to do with the amount of empty cells before the one with data. Any help or advice will be much appreciated. 回答1: You probably have a connectionstring like this: <add name="MyApp.Properties.Settings

How to get a DataRow out the current row of a DataReader?

こ雲淡風輕ζ 提交于 2020-01-12 12:12:25
问题 Ok, I would like to extract a DataRow out a DataReader . I have been looking around for quite some time and it doesn't look like there is a simple way to do this. I understand a DataReader is more a collection of rows but it only read one row at the time. So my question: is there any way to extract a DataRow out the current row of a DataReader ? 回答1: Is there any way to extract a DataRow out the current row of a DataReader ? No, at least no simple way. Every DataRow belongs to one Table. You

How to get a DataRow out the current row of a DataReader?

守給你的承諾、 提交于 2020-01-12 12:12:24
问题 Ok, I would like to extract a DataRow out a DataReader . I have been looking around for quite some time and it doesn't look like there is a simple way to do this. I understand a DataReader is more a collection of rows but it only read one row at the time. So my question: is there any way to extract a DataRow out the current row of a DataReader ? 回答1: Is there any way to extract a DataRow out the current row of a DataReader ? No, at least no simple way. Every DataRow belongs to one Table. You

How to get a DataRow out the current row of a DataReader?

孤者浪人 提交于 2020-01-12 12:10:25
问题 Ok, I would like to extract a DataRow out a DataReader . I have been looking around for quite some time and it doesn't look like there is a simple way to do this. I understand a DataReader is more a collection of rows but it only read one row at the time. So my question: is there any way to extract a DataRow out the current row of a DataReader ? 回答1: Is there any way to extract a DataRow out the current row of a DataReader ? No, at least no simple way. Every DataRow belongs to one Table. You

How much data can be stored in network buffer when datareader is used

烈酒焚心 提交于 2020-01-11 09:38:30
问题 all we know that datareader works like The datareader reads a record at a time, but it reads it from the underlying database driver. The database driver reads data from the database in blocks, typically using a buffer that is 8 kilobytes. If your result records are small and you don't get very many, they will all fit in the buffer, and the database driver will be able to feed them all to the data reader without having to ask the database for more data. If you fetch a result that is larger

R trouble reading my files with read.csv

对着背影说爱祢 提交于 2020-01-07 03:14:29
问题 I'm currently trying to read two .csv files, edit the data, and then write it into a new .csv. here the code : data <- read.csv("file.csv"), fill=TRUE, header=TRUE, row.names=NULL, stringAsFactors=FALSE, sep=",", quote="") write.csv(data, file="out.csv") Here's the problem : Everything is fine with the first file (20 columns, 572 observations) However, the other file has 163 columns and 1578 lines but when I read it with read.csv, R displays "2301 observations of 163 variables". I tried to