IDataReader To Delimited String Function Efficiency?

Nov 16, 2009

I have a function that I use to export the contents of anything that implements IDataReader into delimited string (that I can then write to disk or send to a response stream). It works, and it's quick for smaller recordsets but gets bogged down once the record counts get over a thousand (I have something that does the same thing only it writes to a new Excel spreadsheet and it runs in about 25% of the time). I understand that with record sets that are very large, this could cause a memory issue since I'm reading it into a string, but typically these won't be any larger than 100k (if written out to disk). My question is, here's my function, is there anything you can spot that I could do more efficiently (like, I suppose I could stream line by line to the response in asp.net, or line by line to the file on a console app, I haven't tried that).

[Code]...

View 1 Replies


ADVERTISEMENT

Get A Regular Expression That Can Validate That A String Is An Alphanumeric Comma Delimited String?

Jun 23, 2011

I need a regular expression that can validate that a string is an alphanumeric comma delimited string.

Examples:

123, 4A67, GGG, 767 would be valid.
12333, 78787&*, GH778 would be invalid
fghkjhfdg8797< would be invalid

This is what I have so far, but isn't quite right: ^(?=.*[a-zA-Z0-9][,]).*$

View 3 Replies

Ado.net Error (Unable To Cast Object Of Type 'System.String' To Type 'System.Data.IDataReader'.)?

Jan 29, 2012

I am getting this error when I am tring to load string type to data table)

Using connection As New SqlConnection("connectionstring;")
connection.Open()
Using Command As New SqlCommand("SELECT ClientId,forename,surname from t_clientdetails

[code].....

View 1 Replies

.net - De-serializing A Space Delimited String Into A Generic List?

Oct 19, 2011

I have an xml file with elements that look like this (abbreviated for clarity):

<post id="1" tags="tag1 tag2 tag3 tag4" />

I want to map this to the following class using Xml Deserialization, but I can't find a way to map the tags attribute to an actual List(Of String).

<Serializable()> _
<XmlRootAttribute("post")> _
Public Class Post

[Code]....

Is there any way to override the default Deserialization?

View 2 Replies

Asp.net - Retrieve A Comma-delimited String Of Values From A Text Box?

Nov 3, 2010

I have a textbox AND 3 checkboxes; checkbox1, checkbox2, checkbox3

In textbox we have 1,2,3

If I type in textbox1 = 1,2 then

checkbox1 and checkbox2 will be checked and checkbox3 will remain unchecked.....

How to do this in vb.net

View 3 Replies

Converting ArrayList Into String Of Comma Delimited Values?

Mar 1, 2010

How do I convert an arraylist into a string of comma delimited values in vb.net. I have an arraylist with ID values
arr(0)=1
arr(1)=2
arr(2)=3

I want to convert it into a string
Dim str as string=""
str="1,2,3"

View 2 Replies

Parse A Space Delimited String Into A Double Array?

May 25, 2010

in parsing a string which is delimited by space in to a Double Array

View 1 Replies

VS 2008 - Connection String Bug - Reading A Tab Delimited File

Aug 2, 2009

I want to read a tab delimited file so i set up a data reader with the following connection string: [Code] However when I do this it doesn't seem to delimiter at the tab characters (I cannot work out why it is breaking up the data where it is). the first few lines of the csv are in the attached "dbamstr.txt" - the select statement I am running is: "SELECT * FROM dbamstr.txt".

View 3 Replies

VS 2008 Sort A Comma Delimited String To Different Textboxes?

Mar 22, 2010

sort a comma delimited string to different textboxes.Ex.

111,222,3,44,5555,66
to
Textbox1
Textbox2
Textbox3

[code]....

View 5 Replies

Write This Block Of Code That Parses A Delimited String Into An Object?

May 8, 2009

Is there a more elegant way to structure the following code, which takes a comma delimited string containing certain values in specific positions and assigns the values to the properties of an object?[code]...

View 5 Replies

How To Select N Rows Using IDataReader

Oct 27, 2011

[ASP .Net - Microsoft Visual Web Developer 2010]I've problem with this code:

[Code]...

Then, using that xReader.Read, store the value on the database onto that label based on the OrderNumber...

View 1 Replies

DB/Reporting :: IDataReader And Connection Open?

Dec 28, 2010

In our application we use IDataReader which actually call function from one.dll where weExecureDataReader()
We have many calls in application and in some places For some reason I am getting error message "DataReader already open" but I am not sure where.What will happend if I simple close that conection in the that .dll? Am I going to make trouble to database because one datareader left opened? I assume closing connection will close reader too and gargage collector will manage that left opened datareader..

View 2 Replies

Extract Information From The IDataReader Object?

Feb 16, 2012

I have two cases to extract information from the IDataReader object

Case - 1 - Length, calculates ordinal and then parse string

public static string GetString(IDataReader rdr, string columnName)
{
int ordinal = rdr.GetOrdinal(columnName);

[Code]....

Which technique should be preferred and why and if any specific context ?

View 3 Replies

Stored Procedure In Oracle And IDataReader.Read()?

Sep 21, 2011

I have a Stored Procedure that seems to be very slow. Executing it in Oracle SQL Developer;

SET TIMING ON;
DECLARE
CUR_OUT UTILS.T_CURSOR;
P_ARTTYID NUMBER;
P_ORDERST VARCHAR2(200);

[Code]...

View 1 Replies

Convert A Pipe Delimited File Into A Tab Delimited File And Show Results In Listbox VBA?

May 7, 2011

So i'm new to working with vba in access and i'm having trouble getting this code to work. What it is suppose to do is take a selected text file and read the original file into a list box. Then there is a second button that when pressed will convert the text file from a pipe delimited file into a tab delimited file and then show the changed file into a new listbox.

Option Compare Database
Option Explicit
Function GetFilenameFromPath(ByVal strPath As String) As String

[code].....

View 2 Replies

.Net Stack Collection Efficiency?

Apr 15, 2009

I've started using .Net's stack collection. The basic features I guess are the "pop" and "push", where you add or take off the top element of the stack (if you are referencing other elements in the stack then another collection type is probably better).[URL]..it appears that the Stack collection (like other collections) is basically an array with some window dressing (so you actually can see other elements). As far as I can tell, "popping" and "pushing" is changing the first element of the array. Shouldn't instead the final element be the "top" of the stack and be the one that is changed? Otherwise the program has to reindex all the other elements in the array every time a pop or push is made. This seems very inefficient. But this is what Microsoft's description appears to be saying what is happening.

View 10 Replies

Difference When We Compare The Efficiency Of .NET And C#?

Jan 19, 2012

For example, when the codes are compiled, will VB.NET tend to be slower than C#? Or are there any major features in VB.NET / C# that we cannot find in the other language?

View 1 Replies

Process Efficiency And Possible Way To Parse

Aug 9, 2010

So i am working on a program that needs to run NSLookup for a Computer name specified by the user. Here is the code I have developed which works:[code]Now because of the dynamic domains that this will be on, it is difficult to nail down which character to start a read at to determine if the Computer name exists. For some reason the reader is not picking up the '***Non-existent' line that is reported from NSLookup. When i run the NSLookup it requires me to run the Function 2x before it displays a result in my lblresults. With that pre-knowledge,

1. How do i make the NSLookup Process more efficient?

2. Is there a better way to Parse the information to specificly pull the lines that have been reported back, specificly the '***Non-existent' line.

View 1 Replies

Efficiency Of Using Try - Catch To Test A Condition

Oct 19, 2009

Tell me if this is efficient code. or if there would be a more efficient way of doing this:

CODE:

I'm wondering if error catching will take more. time than a few more lines of code to accomplish the same.

View 3 Replies

If Statement Efficiency - Reducing The Code ?

May 27, 2011

How would you go about reducing the code for this but still allowing it to work the way it is now

Dim updatelesson As String = cmbChange.SelectedIndex
Dim chosenlesson As String = cmbSession.SelectedIndex
Dim changed As String = lstNames.SelectedItem

[CODE]....

View 3 Replies

Loop Variable Declaration Efficiency?

Jan 27, 2012

wondering about the relatively efficiency of declaring oop variables in the loops, emselves, or declaring them before first use. Here are some examples:Declare early:

Dim ix As Integer
Dim currentNode As System.Xml.XmlNode
For ix = 1 To 100

[code].....

View 9 Replies

Ongoing File Encryption / Efficiency

Jul 13, 2011

I'm looking for advice/ideas in regards to ongoing file encryption.I have an event that fires frequently that contains small amounts of data passed through the eventargs.This data is then written out to disk (currently unencrypted).I need to encrypt this data (which, I can do).My attempt in the first five minutes was unencrypting the file, appending the data and reencrypting the file.This obviously works, but is pretty inefficient and not going to be my solution since the file could grow rather large and the resources to unecrypt/ encrypt grow larger as the file grows larger.My next thought was to encrypt each set of data as it's written out and have some kind of marker in the file to denote where to split so I could unencrypt each chunk to reproduce the original file.I'm leaning towards this approach now (though by encrypting small chunks of data multiple times, the file size will be considerably larger.As an example, if I encrypt each letter of the alphabet the file is approx 8 times larger than if I encrypted a string with all of the letters of the alphabet in this case each files decrypted content would be identitcal).

View 3 Replies

Test My Codes Efficiency In Program?

Jun 25, 2011

How can I test my codes efficiency in vb.net?

View 1 Replies

VS 2008 Efficiency Comparison Of Nested Ifs?

Jul 20, 2010

which is more efficient?(Assume case statements, etc., cannot be used.)

If a Then
If x Then
ax()
ElseIf y Then

[code]....

View 4 Replies

Algorithm String - Function Encrypt And Function Decrypt ?

Jun 13, 2011

I have 1 string : abc @#ABC.xyz123ZYX

Now I need to encode the string:

The encoding alphabetic characters,

CODE:

With this string, after encoding, the result is: zyx @#ZYX.cba123ABC

About Function Encrypt and Function Decrypt?

View 1 Replies

Call A Function / String That It Uses Will Be Given To Function To Initiate A Download?

Aug 21, 2009

Some programs implement command parameters, Like my favourite computer game - Crysis - has them and windows media player has them.But how could i implement them in VB.NET..I want to have a component of my program built as a seperate exe - so it can be an Optional component.But of course the seperate exe, on load, needs data passing to it.So i need something like Process.start("Componentname.exe", "/StartDL <Suchandsuchastring>)/StartDL will need to call a function, and the string that it uses will be given to the function to initiate a download?

View 9 Replies

VS 2005 By Reference Variable Memory Efficiency

May 27, 2009

I'm building SQL statements with a bunch of values from a dataset. Obviously that gives some really long names to put inline or even in parameter. addwithvalue code so beforehand I just declare a bunch of variables with really short names and assign them to the DS's exact fields like: [code] but this way I'm putting all the data in the dataset into memory twice by copying it into a new variable, right? So I was thinking, if it's just a string variable representing a field on the dataset, why not declare it by reference so the variable is basically a handy nickname pointing to that field in the dataset.Will it even work to have a string declared by reference and connected to one value inside of a dataset? And if so, will that stop duplicating everything in memory? I forgot how to declare a variable as a reference to another variable instead of the normal way in VB.

View 12 Replies

Update Records In MVVM Pattern For Maximum Efficiency?

Mar 14, 2012

This is more a conceptual question. Here is my current predicament; I am writing a vb.net WPF application and using the MVVM pattern (love it! maintainability is just amazingly awesome). Currently all the code is written by hand and there is no use of NHibernate or Entity Framework as the backend is an access database (due to policy I cannot use NH and EF doesn't support JET Databases, we may switch to MSSQL at some point but that may be a while from now).[code]...

View 1 Replies

String Concatenation String + Function Output + String = String + Function Output And No More?

Feb 4, 2010

The following output produces a string with no closing xml tag. m_rFlight.Layout = m_rFlight.Layout + "<G3Grid:Spots>" + Me.gvwSpots.LayoutToString() + "</G3Grid:Spots>"

This following code works correctly

m_rFlight.Layout = m_rFlight.Layout + "<G3Grid:Spots>" + Me.gvwSpots.LayoutToString()
m_rFlight.Layout = m_rFlight.Layout + "</G3Grid:Spots>" 'add closing tag

What's going on here, what's the reason the first example isnt working and the second is?

The gvwSpots.LayoutToString() function returns a string.

View 3 Replies

VS 2010 Comma Delimited Text Into Tab Delimited Text?

Feb 11, 2011

how to make a text conversion like the below pic -

1. the textbox 1 is multiline with an array of comma delimited and tab delimited text.

2. the textbox 2 is one line textbox

3. A,B,C,D,E,F,G is where the position of each string before / after conversion

View 5 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved