Solved

VB.NET - SQL Server

Posted on 2004-09-28
9
697 Views
Last Modified: 2012-06-27
Hi,

I have a few questions.

1. Does anyone know where I can find data type comparison chart between VB.NET and SQL Server data types.

2. I have a piece of code which uses a data reader to bring in a set a records, I loop through each record and assign it to a class then add the class to an array list. For each field I check it is not null, if it is not null I convert it to the relevant class property type.

The problem I have is this, when the field is a sql server timestamp or datetime can I use the System.Convert class to convert them or do I need something else?

The class properties are declared as follows

timestamp = object
datetime = date

0
Comment
Question by:rocky050371
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
9 Comments
 
LVL 96

Expert Comment

by:Bob Learned
ID: 12170012
Do you have some relevant code to highlight what you are saying?

Bob
0
 
LVL 7

Accepted Solution

by:
natloz earned 43 total points
ID: 12170026
you can simply use

Dim dteDate as DateTime <--------- for the SQL DateTime

and I believe that SqlBinary is the datatype in VB.Net that is equivilant to timestamp
0
 

Assisted Solution

by:brunka
brunka earned 41 total points
ID: 12170971
0
SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

 

Author Comment

by:rocky050371
ID: 12173335
Thank you for the link, but I am left with a decision to make, does anyone know where it is better to stick to SQL data types throughout the program, i.e declared in the class etc than use VB's own internal data types. For example if the data field is varchar in SQL Server is it better to assign it to a property whose data type is string or SQLString? Just wondering whether this will cause any problems while manipulating an array of classes or binding which is done higher up the architecture.




0
 
LVL 96

Assisted Solution

by:Bob Learned
Bob Learned earned 41 total points
ID: 12173349
IMHO it is better to stick to data types that are base types, such as String, Integer, etc.  A lot of functions don't understand what an SQLString type is.

Bob
0
 
LVL 7

Expert Comment

by:natloz
ID: 12174205
I agree with Bob...I have had problems with SQLDataTypes in VB.Net...I generally only use the SQL datatypes when passing to stored procedures (at the time I pass to the stored proc I make sure it is in a compatible VB.Net datatype)...it will crash if it isn't!
0

Featured Post

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: Kraeven
Introduction Remote Share is a simple remote sharing tool, enabling you to see, add and remove remote or local shares. The application is written in VB.NET targeting the .NET framework 2.0. The source code and the compiled programs have been in…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question