
Afraits
Avatar/Signature-
Posts
73 -
Joined
-
Last visited
Content Type
Profiles
Forums
Blogs
Events
Articles
Resources
Downloads
Gallery
Everything posted by Afraits
-
Use the Fileinfo class to get information about the file before opening it, or use the basestream property of the streamreader which should then provide access to the base Filestream property of length, the filestream class also exposes a property position which should give the byte position within the file. Alternatively you can count the number of bytes in each line of data that you read and track the position that way.
-
You should be able to get the total file length and the number of bytes read in each line - hence display the bar as the proportion of bytes read rather proportion of lines read.
-
Help on DataGrids and DataAdapter with ADO.NET
Afraits replied to FtKarras's topic in Database / XML / Reporting
DBConcurrency exception will usually mean that a row has changed in the underlying DB between you populating the grid and trying to update it. Is that scenario possible? -
If you are performing string parsing - perhaps regular expressions may be useful for you, although more overhead they are quite flexible and powerful and so may work out better in the long run, check the regular expressions for examples and as a place to post questions. For your actual question however I have no idea :)
-
Investigate the System tables within SQL Server, they do take a bit of understanding to know what is going on though. The starting point would be sys_objects.
-
Yes the datagrid should populate changes back to the dataset if its a bound control and you haven't set the grid to read only. Then its just a matter of calling dataadapter.update to move changes back to the DB. But if you are in a multiuser environment do some research on concurrancy first to avoid problems when multiple users change the same thing.
-
Besides checking the width of character 'M' and comparing it to 'i' (for example) which will only be the same for a fixed width font? going off memory some font formats do have flags that say whether a font is fixed-width but that would require you to understand the font format and parse the font file itself i think.
-
According to ducumentation on MouseWheel event arguments, one mouse wheel click gives a delta of 120 (+ or -), 'aggressive scrolling' may then register more than 1 click between events being raised.
-
That error would suggest that the format of the date in the string format you pass in isn't valid or isn't being interpreted correctly, so first step ensure a valid date is being passed in, secondly try an explicit format such as 13-MAR-2005 instead of 13/3/05, thirdly use the 'CONVERT' command in SQL Server to specifiy a format eg CONVERT(DATETIME, '''+ @DOB +''', 103) would expect an English style datetime format. Having looked at the sp I think the part " ... , '+cast(@DOB as datetime)+' , ..." should be written "..., CAST('''+@DOB+''' as datetime) , ...." (or the convert if you go that way) Hopefully one of those will solve the problem.
-
Perhaps you could post as much of the stored procedure as possible so we can see how you've set it up.
-
A primary key is the main index on a table, and as such will speed up queries and navigation especially when tables are linked via such fields. It is good practice to always have a primary key on a table.
-
Yes, you will need to raise events do pass property changes back to the form. You may notice that in the textbox's event list it contains events such as backcolor_changed which are providing the text box with the functionality you wish to implement for your person class.
-
If its part of the framework isn't it referenced automatically? And as .NET 2003 points at the 1.1 framework by default and this is a V2 framework feature then there is likely to be be a compatability issue.
-
Data in excel file to SQL Server Database table
Afraits replied to mike55's topic in Database / XML / Reporting
You can call a DTS package from code as I've maintained code that does it, unfortunately I don't have access to that code anymore. :o But it can be done. -
True, a lot does depend on what you are trying to do and why you want to do it a particular way. In my first post I almost added in a proviso that using regex may be overkill but then decided not to :p If you need to do a case insensitive replace on a string while leaving the rest of the text unchanged then regular expressions are the only way I know. However why this is necessary I'm not sure. So your point is valid and perhaps JDYoder could tell us exactly why changing the case of the rest of the string is a no go. I would also add that using the stringvar.ToLower().IndexOf (or ToUpper) would be fine if all you are after is a position within the string.
-
A regex.match object has an Index property which is "The position in the original string where the first character of the captured substring was found" - ie exactly what indexof would return.
-
Regular expressions are a pattern matching tool - see the regular expressions forum and look up via MSDN for more detailed info. They are more flexible than the indexof and replace functions within the string class and are obtained from the System.text.RegularExpressions namespace. Briefly you use them like this regex myregex=new regex("wordtomatch",regexoptions.ignorecase); string stringToChange="A bunch of CASE inSensItve text containing WORDtoMaTCh amongst other things"; stringToChange=myregex.Replace(stringToChange,"changedword"); Console.WriteLine(stringToChange); Will output "A bunch of CASE inSensItve text containing changedword amongst other things" Plus is able to do more powerful matching and replacing than indexof & replace.
-
A regular expression replace function with regexoptions.ignorecase may provide the solution you are looking for. Check the regular expression forum.
-
If it is being done on a SQL Server then build a scheduled DTS package to run your query, then build and send the result via email to the appropriate people.
-
I have a regular expression to aid me in extracting information from a file: (ALPHA|NUMERIC|DATE)\s+(\w+)\s+ Which extracts a type descriptor and the variable name into the cature groups. However a textline may have one or more ';' characters followed by (and/or preceeded by) whitespace which acts as a comment and hence in these cases I would like the expression not to match. Is there a way to do this without performing a seperate extra check for a ';' preceeding the part I want?
-
DataReader Close causes system to hang.
Afraits replied to LeifW's topic in Database / XML / Reporting
Try calling cancel on the underlying command object within the reader - can't remember the syntax offhand but the underlying command object has work to do once the reader is finished - if you call the command object's cancel method before closing the reader it may help. -
Directory class GetDirectories method returns a string array of the subdirectories. e.g. Dim subdirectoryEntries As String() = Directory.GetDirectories(targetDirectory)
-
How to make the case for Access->SQL Server migration?
Afraits replied to samb's topic in Database / XML / Reporting
A few years ago I used Access as the back end for a little app for the purchasing dept to keep track of the suppliers used. Without getting into details it used the primary key (autonumber field) of the main table as part of the link between GUI and data using a VB int (surely 32k different suppliers for a company our size would be more than enough :rolleyes: ). As this was a small app - only a couple of concurrent users I thought it would be safe. A few months ago some runtime overflow errors occurred On investigation I found that the autonumber field had incremented past the VB6 integer limit. There were only a couple of hundred entries in the table but the autonumber field would occassionally make large jumps - 2000 here 5000 there, in 1 case it was 15k and I find it difficult to believe that user error could result in 15,000 wrong and deleted entries before they got it right :eek: . Hence must have been the Access DB itself. It was simple to change Int to Long but enough to convince me never to use Access in a multi user environment again. There are ways around this but in my opinion not worth the effort of having to setup and track your own ID fields & hopefully an actual example of data corruption may give added weight to your position. -
PLus a someone in the old thread pointed out that framework V2 has a DateTime.TryParse implies that Microsoft have listened to developer comments and provided further .NET equivalents that move away from the use of the VisualBasic namespace
-
Just as a question, why would you have something you intend to have a date or number in that isn't defined as such? Though you can take typing shortcuts to avoid the tempvariables eg str=DateTime.Parse(str).ToString("MMMM yyyy") Although this will create a temp instance of a datetime variable (to store the result of DateTime.parse) it will immediately be free for garbage collection.