473,394 Members | 1,951 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Reading from a DB - please help

Hi everyone,

Hope that you can help me please. I am parsing approx 1.34M record in
a database. I read a line, parse it and then write out this new line to
a new column.
However I have notice that occasionally the system reports an error of
the type:
************** Exception Text **************
System.Data.SqlClient.SqlException: Timeout expired. The timeout
period elapsed prior to completion of the operation or the server is
not responding.
at System.Data.SqlClient.SqlCommand.ExecuteReader(Com mandBehavior
cmdBehavior, RunBehavior runBehavior, Boolean returnStream)

I reckon its occuring during the reading process. The function
associated with this is included below. I reckon that I am gobbling up
too many resources or its inefficient or something. Perhaps I should
use the Dispose() method somewhere.
Could you have a look at it please? Any
comments/suggestions/improvements/ideas/code-samples would be much
appreciated.

Al.
The confused


************ INEFFICIENT READ FUNCTION AS FOLLOWS
***********************

Public Function ReadSoundexWords(ByVal rowNo As Integer) As String

'Read a soundex field from a particular row
Dim asFieldSqlCmd As New SqlCommand
asFieldSqlCmd.Connection = mySqlConn
asFieldSqlCmd.CommandType() = CommandType.StoredProcedure
asFieldSqlCmd.CommandText() = "dbo.spReadSoundexField"
Dim strSoundexwords As String
Dim strParsedSoundexwords As String

'Input parameter: alp_pk
Dim Prmt_geo_pk As SqlParameter = New SqlParameter("@"alp_pk",
SqlDbType.Int)
Prmt_geo_pk.Value() = rowNo
asFieldSqlCmd.Parameters.Add(Prmt_alp_pk)
Dim soundexwordsReader As SqlDataReader =
asFieldSqlCmd.ExecuteReader

While soundexwordsReader.Read
strSoundexwords = soundexwordsReader.Item(0).ToString()
strSoundexwords = strSoundexwords.Trim()
End While

'Close the reader
soundexwordsReader.Close()
Return strSoundexwords

End Function

Mar 1 '06 #1
0 833

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Dietrich Epp | last post by:
Are there any good modules for reading a bitstream? Specifically, I have a string and I want to be able to get the next N bits as an integer. Right now I'm using struct.unpack and bit operations,...
1
by: fabrice | last post by:
Hello, I've got trouble reading a text file (event viewer dump) by using the getline() function... After 200 - 300 lines that are read correctly, it suddenly stops reading the rest of the...
1
by: Randell D. | last post by:
HELP! I am determined to stick with this... I'm getting there... for those who haven't read my earlier posts, I'm createing what should be a simple function that I can call to check that...
7
by: Shane | last post by:
Hi, Thanks in advance for the help. I have been to many websites and tried several solutions to my problem, but have fixed part of it. It's time to come humbly to the newsgroups for help :-) ...
21
by: JoKur | last post by:
Hello, First let me tell you that I'm very new to C# and learning as I go. I'm trying to write a client application to communicate with a server (that I didn't write). Each message from the...
2
by: Jonathan Hunt | last post by:
Hi all, I have had a look on google/freshmeat etc. so please forgive me if I've missed an obvious answer. Can someone point me to a simple library to read/write ODF spreadsheets (i.e. ...
1
by: CodeSeeker | last post by:
I have an application, which uses pop3 to read the messages from the mailbox, and it has been working fine for so many year. We recently have started changing this application to use java mail IMAP 4...
3
by: NaN | last post by:
Hi I'm using Dev-C++. Here is my sourcecode. /* GETCH.C: This program reads characters from * the keyboard until it receives a 'Y' or 'y'. */ #include <conio.h>
5
by: Justin | last post by:
Here's my XML: <?xml version="1.0" ?> <AppMode Type="Network"> <CurrentFolder Path="c:\tabs"> <Tabs> <FilePath>tabs\Justin.tab</FilePath> <FilePath>tabs\Julie.tab</FilePath> *****There could...
4
by: dacuteangel04 | last post by:
ok what my program is suppost to do is open a file - Grades.txt and read each line the breaking the lines down w/ tokens so i may later average some numbers an example some of the lines from the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.