Solved

VB.NET - SQL Server

Posted on 2004-09-28
9
686 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
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
Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 

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

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Introduction As chip makers focus on adding processor cores over increasing clock speed, developers need to utilize the features of modern CPUs.  One of the ways we can do this is by implementing parallel algorithms in our software.   One recent…
Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

757 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now