Solved

VB.NET - SQL Server

Posted on 2004-09-28
9
699 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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 

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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Since .Net 2.0, Visual Basic has made it easy to create a splash screen and set it via the "Splash Screen" drop down in the Project Properties.  A splash screen set in this manner is automatically created, displayed and closed by the framework itsel…
The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …

634 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