|
You need to "explain" to the code that '0000' is a string and not a number.
You could try it by adapting the sql, something like this:
"Select CAST(YourQuadrupleZeroField AS NVARCHAR(4)) as YourQuadrupleZeroField From [" + sFile + "]"
Remember that the 4 should be the maximum possible length (number of characters) of that field.
Hope it helps,
Johan
My advice is free, and you may get what you paid for.
|
|
|
|
|
The field containing '0000' is a varchar field.I am using Oracle database.
I need to read all the fields not only one field so that's why using
"Select * from [" + sFile + "]"
There are more than 25 fields in the file.
|
|
|
|
|
No matter what you should still explicitly specify the columns you want returned from the SELECT statement for performance reasons. That being said, how your database table is defined is completely irrelevant to your problem. The problem is happening when you create the ODBC connection to the CSV file. Since the field in question contains numeric data, the Jet engine is treating it as a numeric field. (If you look at the column properties for the DataTable that was created for you, it should show that the column is a numeric data type.)
You need to explicitly convert the column to text data in your SELECT statement by casting it or create a schema.ini file that defines the column data types. See http://support.microsoft.com/kb/187670[^] for more information on the schema.ini file.
|
|
|
|
|
Using an MDI form, it's easy to set up a row or column of buttons to the side of the client area. Is there any nice way to use a splitter so the user can resize the client area (assuming the buttons can resize themselves to their container)? The splitter control is very nice for most such purposes, but I don't see any way to set one of the panels to behave as the MDI client area. Is there any nice way to do so, short of using a fake splitter control and using click/mousemove events to force-resize the button bar?
|
|
|
|
|
It's possible to do, but not easily. On an MdiParent form, there is a control that's automatically put on the form which handles all of the MdiChild windows and provides a place to render them. This control is a class, just like any other control on the form, called MdiClient. Since it is a control, deriving from the Control class, it behaves just like any other control. All it needs is a parent container to render itself in. By default, the MdiClient control is added to the MdiParent form's Controls collection. All your code has to do is find the MdiClient control and give it a new parent container, such as one of the Panels of a Splitter container.
There is a problem with this though. Any NEW instances of a form that you want to add to the MdiParent won't work unless you move the MdiClient control BACK to the MdiParent form's Controls container. What this means is that while you CAN put the MdiClient control on the right side of a splitter, you cannot add any MdiChild forms to it until you move the MdiClient back to where you found it, add the form, then move the MdiClient back to the right-side panel of the splitter.
Why? Because once you move the MdiClient from the Controls collection of a Form, it's no longer considered an MdiParent form and cannot be used to set the MdiParent property of a new form instance.
There might be a way around this, but I'd have to test it before I say anything.
|
|
|
|
|
I have a directory tree control which uses a Try/Catch stmt. As the code loops through file fodlers, the Catch picks up on the fact that I am trying to access a Norton (Symantec) folder which I do not have access to on my C Drive. I need to find a way to error handle the code so that it progress and continues to populate my Tree Control. The way it works now is it prompts the user with an error message and then the code stalls.
Private Function GetDirectories(ByVal PathIn As String, ByVal NodeIn As TreeNode) As Boolean
Dim HasFiles As Boolean = False
Dim MyNode As TreeNode
Dim MyDirs() As String
Dim LocalPath As String = Nothing
Try
MyDirs = Directory.GetDirectories(PathIn)
For Each Item As String In MyDirs
MyNode = New TreeNode(PathIn & "\" & Item)
HasFiles = Me.GetDirectories(Item, MyNode)
If HasFiles Then
NodeIn.Nodes.Add(MyNode)
End If
HasFiles = Me.GetTextFiles(PathIn, NodeIn) Or HasFiles
Next
Catch ex As Exception
MsgBox(ex.Message)
End Try
Return HasFiles
End Function
Thanks
EM
|
|
|
|
|
Okay, so the proper way to do this would be to check whether you have access to a directory, before adding it to your tree. However, I personally don't know how to do that, so I suggest you simply use an inner try-catch clause. In other words, step through your app in debug mode, determine at which point exactly the error is thrown, and put just that sentence, or block of code, in its own try and catch block, such that the try catch block is nested inside the loop.
My advice is free, and you may get what you paid for.
|
|
|
|
|
hi every body,
i want to learn how to create user control and set property and events
Ahmed hassan
|
|
|
|
|
Look around on this site. There are plenty of good articles if you use the search tool.
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|
|
hi,
I want validation to create texbox write arabic only
Ahmed hassan
|
|
|
|
|
Again, do a search on this site or google.
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
|
|
|
|
|
Hello every one
I am working on a application which was originally done in VB6 and then migrated to vb.net 2005 express…
A lot of changes had already undergone in the application and it is working fine, now we are undergoing lot of new additions..
We are using ADODB to connect to the database with a connection object and have a recordset to access data.
- Now the issue is that if the N/w connection breaks to the DB server the I wanted the application to retry (as in case of wireless, signals do drop and come back at times) after few moments.. But even when the network is back again the application still dose not connects to the DB server…
- I checked the connection object’s status and recordset also.. Both seem to be fine…
Can any one plz help me on this..
Regards
Nishkarsh
|
|
|
|
|
I am sorry I do not have a ready solution for you, but we experience the same problem with PDA's on our WLAN. We have found out that for us the problem is caused because the device does not receive a new IP address from the server, after the connection was dropped.
If your problem is related, you could try to make your device renew its IP configuration before you try to reconnect to the db.
Hope this is of help to you,
Johan
My advice is free, and you may get what you paid for.
|
|
|
|
|
Thanks for the input...
I am using static IP address on the client machines..So there is no issue to acquire new IP address..
Is there any way to refresh the connection and recordset objects??
modified on Thursday, December 20, 2007 12:29:26 AM
|
|
|
|
|
Hi!
i have many textboxes on a form in a vb .net 2005 application
these textboxes are databound.
Is there any way i can set the MaxLength property of these textboxes (which are bound to varchar fields in the database) to the size of the field in the database.
Or how do i access the field (i.e. DataColumn of the table) to which a textbox is bound.
Thank You
|
|
|
|
|
may be you should try textbox1.mexlength = 20 'Length
Good Luck
|
|
|
|
|
but, the problem remains. what length should i set as i don't know the lenght of the field in the database?
|
|
|
|
|
You can query the database for the length, assuming you are using SQL server. Not sure about other DBs.
|
|
|
|
|
for that issue u have to keep track of which field u are accessing
There is another way to do it but this will introduce a real big overload on the system and application will become slow...
What you can do is just before you set the size of textbox do a query and to get the field size(I am not sure how to do it... but for sure there will be a query for sure)... and then assign the max size of textbox
Good Luck
|
|
|
|
|
why do i need to query the database for the length of the field since my textboxes are databound (using drag & drop from the data sources window) and the properties of the the datatables show the mapped fields (i.e. varchar(6) to system.string with length 6). Is there any way I can access these properties of the datatables.
|
|
|
|
|
My existing VB6 programs make extensive use of random files read and written to using complex structures. For example...
Private Type RightsElement
ItemName As String * 10
ItemFolder As String * 32
End Type
Private Type OneUser
UserName As String * 20
Password As String * 20
AllRights (0 to 64) As RightsElement
End Type
I could then declare a variable such as
Dim ThisUsersRights As OneUser
and subsequently read or write to a random file using this variable.
I have tried in vain to make this work in VB.Net 2008. I NEED to be able to read my existing files. Can anyone offer any suggestions? Or perhaps point me in the right direction for getting an answer?
Many thanks.
Steve
|
|
|
|
|
Is there a specific problem you are having?
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
|
|
|
|
|
Hi, I am doing a project for my school and I have a scenario like this:
Say I am making a event planner website. This site itself do not sell anything but has to provide props, goodies for the event therefore it needs to link to a supplier website (which is created by myself too) and I am using their product data to put on my website.
I wish to do it using XML such as they can send me an agreed upon XML format.And my Event planner website will automatically accept the xml and use the data inside to be put on my website in my format.
Do you think it is feasible?
Then here is the problem which i hope somebody can answer me.
1.How do they send me an xml file which will be automatically processed by my system(no human intervention).How do my system know that someone is sending and prepare to accept it? Could you point to me whether is there any class to use?
2.If say the first time this supplier send me the xml file and my system happily accept it and show my website, then a few weeks later this supplier change the price of only one product. what are the ways to program the system to be able to make the system intelligent enough to just update the one products change. Is there any class again in the VB to create xml file?
Thanks a million
|
|
|
|
|
xavier1988 wrote: Do you think it is feasible?
Yes, we have a system that does this, but it has been written in PHP.
xavier1988 wrote: How do they send me an xml file
With ftp. You would need to look into automating ftp transfers. Usually this is done separately from the website program.
xavier1988 wrote: what are the ways to program the system to be able to make the system intelligent enough to just update the one products change.
This and more can best be accomplished by using a database (for example MySQL). It will allow you to design a system that will only update the necessary data. It is also the easiest way to transform the data from the xml file to content on a website.
My advice is free, and you may get what you paid for.
|
|
|
|
|
xavier1988 wrote: How do they send me an xml file which will be automatically processed by my system
There are several different ways to do this:- FTP the files and write a Windows Service that watches that directory. Each time a new file is added the service processes the file.
- Use a web-based file upload component and process the file as part of the upload handler.
- Use a web-based file upload component and save the file to a directory. Using the same type of service described in the FTP option, process the files offline.
There isn't anything already written to do this type of work since it is specific to each project. You will need to write it yourself.
xavier1988 wrote: what are the ways to program the system to be able to make the system intelligent enough to just update the one products change.
The best approach would be to use a database to store the information. When you process the XML file, store each product record in a database table; if the record already exists (same product id/code) then just update the field(s) that changed.
xavier1988 wrote: Is there any class again in the VB to create xml file?
Yes, XmlDocument will allow you to create an XML file.
|
|
|
|