Sql Types - Simple SQL server queries/handling variable types

SQL Server 2000, ASP.Net 1.1

I've been writing this stuff for a while, and can't seem to come to the conclusion of how I should be retrieving data and assigning this data to variables.

Since i'm using SQL Server, I'm convinced that I should be using the datareaders GetSqlDouble (or whatever) function, but this would mean i need my local variables to be one of the SQL types.  The problem with that is, that there will have to be lots of conversions done by me to be able to use a SQL type in my application.

For instance, I have a class where i'm retrieving dates.  In order to retrieve them correctly (Null values included), I need to retrieve them with GetSqlDateTime(), then when it comes time to display the date in a table, i must first check for nulls, then convert to a string.  This seems to be very cumbersome.  Would I be better off just using GetDateTime(), and the .ToString method, and ignoring Sql Types all together?

so, basically, how are you guys using your sql server data?  with the supplied sql types, and doing all of the post-processing work manually?  I feel like i'm having trouble conveying my issue...hopefully someone knows what i mean....i'd just like some direction to save trouble in the long run, since i feel like there's got to be a better way...

Confused!

Thanks,
JJ

0
JJHayesIII
5/27/2005 12:05:32 AM
asp.net.sql-datasource 29906 articles. 0 followers. Follow

1 Replies
865 Views

Similar Articles

[PageSpeed] 56

You are not confused ANSI SQL NULL is confusing, it evaluates to NULL but it is not an empty string it is an unknown.  ANSI SQL accomodates human nature other programming langauges .NET included do not.  If you are using SQL Server 2000 and below I would not use sqldouble because you could run into rounding problems, use int and decimal and make your conversions explict, you know the.NET Calendar class is almost all in int with few doubles. Try the link below for working sample code to your problem.   Database NULL is an UNKNOWN and the rest is easy.    Hope this helps

http://www.c-sharpcorner.com/Code/2003/Sept/EnterNullValuesForDateTime.asp


http://authors.aspalliance.com/aspxtreme/sys/globalization/calendarclass.aspx
Kind regards,
Gift Peddie
0
Caddre
5/27/2005 1:20:34 AM
Reply:

Similar Artilces:

SQL A and SQL Server
Hi I heard SQL Server used to be owned by Watcom is this true? Is SQL Anywhere, therefore, similar to SQL Server? -- Regards, John Not quite true. SQL Anywhere was created by Watcom. SQLServer was created by Sybase, and Microsoft licensed the technology. So MSSQL and ASE have common roots, not SQLAnywhere. -- Paul Horan[TeamSybase] "John Kingan" <john.kingan@abibuildingdata.com> wrote in message news:40d82aa1$1@forums-1-dub... > Hi I heard SQL Server used to be owned by Watcom is this true? Is SQL > Anywhere, therefore, similar to SQL Ser...

sql or my sql query
hi,in my database  i have the two tables...1)programs                                2)reservedin the programs...two fields 1)program id           2)maxseats................these details wil be entered by adminin the reserved table  two fileds ..1)PRogramid        2)statusmy requirement is .. i need the available seats..meansif any body is intersted in  any program...they wil select the program...then status becomes approved(1)..then i need the o/p as ...

SQL Server 2005 Installation problems with SQL Server Express & SQL Server 2000
Hi Guys, I have had SQL Server Express and Sql Server Management Studio Express installed on my machine for some time and recently tried to install a trial of SQL Server 2005 as well.  (Yes, I'm migrating from Visual Studio Express to Visual Studio Professional, just as in tended!) Everything went fine except that nothing seemed to be installed.  I searched in all the obvious places - both on the Start/Programs menu and on the hard-drive: nothing. A check under Add/Remove Programs showed that Sql Server 2005 Express was installed, but called SQL Server 2005. So after a number o...

This version of Microsoft Sql Server Management Studio can only be used to connect to Sql Server 2000 and Sql Server 2005 servers
When I connect SQL Server 2005 to a remote database i get the error: "This version of Microsoft Sql Server Management Studio can only be used to connect to Sql Server 2000 and Sql Server 2005 servers". Can I confirm it is because: the remote db is of SQL Server 2008? There is a soln mentioned in http://forums.asp.net/t/1324047.aspx Did anybody try this (installing 2008 express: http://www.microsoft.com/express/sql/download/)? I am just checking again, whether it will disturb my existing SQL Server installation, in any means...? Though it is mentioned that it will g...

SQL Server Reporting Services for SQL SERVER 2000 AND Visual Studio.NET 2005 .NET 2.0
Hi, Which version of SQl Server Reporting Services will work with SQL SERVER 2000 in pararrel with ASP.NET 2.0 (.NET 2.0 framework)?  Thanks, Azam HighOnCodingWanna get high! Hi, Okay I got the answer. Yes, we can use the SQL SERVER 2005 Reporting Services with SQL SERVER 2000. HighOnCodingWanna get high! ...

sql server and sql server express
ok i am puzzled right now....i have a web application connecting to a sql server database....i uninstalled sql server express and installed sql server 2005 full version...i changed the connection string in my application to be Data Source=SKYBANDR62;Initial Catalog=aspnetdb;Integrated Security=True and through the explorer bar i can access my database freely but when i run my application i get this error Server Error in '/' Application. -------------------------------------------------------------------------------- An error has occurred while establishing a...

SQL query that works in SQL Server Management Studio, but doesn't on .NET 2.0 page
SELECT favorites.FID, favorites.filename, favorites.username, files.status, files.private, files.views, files.title FROM favorites INNER JOIN files ON favorites.filename = files.filename WHERE (favorites.username = @username) AND (files.status IS NULL) AND (files.private = @private)@private is manually set to 'no'@username is set to profile.usernamewhen I run the above query in microsoft sql server mgmt studio express on the database, it presents all the information i'm asking for very easily. however when i try to implement this query on a aspx .net2.0 page with teh sqldatasourc...

how to connect sql server using sql query?
Hi all, Please explain how to connect sql server using sql query?. My problem is need to get the data from one server table and insert into another server tables using stored procedure. It is possible by using C# coding. But i need to do using stored procedure. becoz each server have own connection string, username and password.  Please anyone help me? Thanks in advance!!! Hi, You can create a linked server between the two databases and then fire the queries. http://www.sqlservercurry.com/2008/03/how-to-set-up-your-database-for.html   HTH,Suprotim AgarwalA...

Timestamp variable in SQL server 2005 and SQL server express editions!!! Help!!!!
Hi, Can anyone update me whether the 'timestamp' datatype has been changed in the recent release of sql server 2005 or sql server express?? In previous versions it is generating a unique number or row version...it was told that they will be updating 'timestamp' variable to contain the value of current datetime as the word 'timestamp' actually means. Please let me know.. Thanks.. ...

SQL Server 2000 and SQL Server 2005 in the same server
Can enyone please send me a link to a white paper explaining how to run both SQL Server 2000 and 2005 in the same machine?Thanks. I don't know about the white paper but I had both running on my machine for a while by making the SQL 2000 a named instance. So for SQL 2005 connection strings my server name was (local) while for SQL 200 using the named instance it was (local)\joesql where joesql was the instance nameHope it helps,Joe http://www.joeaudette.comhttp://www.mojoportal.com...

Variable Insert to SQL server insert satement setting values for the @variable INSIDE sql
ok, I am on Day 2 of being brain dead.I have a database with a table with 2 varchar(25) columns I have a btton click event that gets the value of the userName,  and a text box.I NEED to insert a new row in a sql database, with the 2 variables.Ive used a sqldatasource object, and tried to midify the insert parameters, tried to set it at the button click event, and NOTHING is working. Anyone have a good source for sql 101/ASP.Net/Braindead where I can find this out, or better yet, give me an example.  this is what I got <%@ Page Language="C#" %><!DOCTYPE html ...

Timestamp variable in SQL server 2005 and SQL server express editions!!! Help!!!! #2
Hi, Can anyone update me whether the 'timestamp' datatype has been changed in the recent release of sql server 2005 or sql server express?? In previous versions it is generating a unique number or row version...it was told that they will be updating 'timestamp' variable to contain the value of current datetime as the word 'timestamp' actually means. Please let me know.. Thanks.. ...

SQL Server Money and .NET Data Type
I'm hoping this is the right forum. Retrieving a Money data-type from SQL Server converts to Double in .NET. But there are rounding problems, I only want 2 decimal points and sometimes rounding will round up the nearest whole integer value. What is the best data type to use for Money where accuracy is critical (financial-number-crunching)? Thanks, Shawn Use the .NET Currency type and not double. System.DecimalThanks,Teemu KeiskiFinland, EU...

SQL code to stop and restart sql server 2005 and sql agent
Hi. I would like to restore a SQL Server 2005 database from a backup file. The problem is that the users which are using the site, prevent the restore operation from completing. So, I stop the sql server by right clicking the server name in management studio and selecting stop, wait for 3-4 minutes and restart it by clicking start. Then I can restore. So I am looking for code that can do these operations (including the wait). let me just add that I am using a named instance - and I want to stop and restart the instance. Please help, thanks in advance. I found this link http://...

Converting MDF files (SQL Server Express) to SQL Server 2005 WITHOUT having to buy SQL Server 2005 (I have Express). Personal WebSite Starter Kit
Hi (and HELP!),   I downloaded the Personal WebSite Starter Kit and got it working no problem on my local machine.  But I've had nothing but frustration trying to get it up and running on a webhosting site.  I picked hostmysite.com which uses SQL Server 2005.  I was under the impression that it wouldn't be that big a deal to convert the .MDF files that Sql Server Express uses to a SQL Server 2005 database.  I tried using SQL Server Management Studio Express.  I was able to "see" my remote database on hostmysite.com, but I was not able to import the .mdf file...

Web resources about - Sql Types - Simple SQL server queries/handling variable types - asp.net.sql-datasource

Anchor handling tug supply vessel - Wikipedia, the free encyclopedia
Anchor Handling Tug Supply (AHTS) vessels are mainly built to handle anchors for oil rigs , tow them to location, anchor them up and, in a few ...

New Facebook SDK For IOS Adds Automatic Error Handling, Improved Login UI
... software-development kit for iOS is now available for download , with significant enhancements including a beta test of automatic error handling ...

Handling Disputes and Refunds
Handling Disputes and Refunds

Facebook Shares Stats on How Users are Handling the Latest Privacy Changes
Facebook’s traffic has yet to be affected by the aggressive privacy changes it made at the beginning of December, from what data we can see — ...

Handling five billion sessi
... that provides app developers with reliable, real-time and actionable insights into their mobile apps. Skip to main content Sign in Search Handling ...

Customer Service Handling
This group is for people in customer service profession facing the customer either in person or over phone.

Wrap Camera HD - Ultimate Picture Editor with Unique Paper Handling on the App Store on iTunes
Get Wrap Camera HD - Ultimate Picture Editor with Unique Paper Handling on the App Store. See screenshots and ratings, and read customer reviews. ...

Dead domain handling page - Flickr - Photo Sharing!
Explore anearthling's photos on Flickr. anearthling has uploaded 1692 photos to Flickr.

Frank Rich Talks New York Media, Handling Criticism - Media Beat (2 of 3) - YouTube
In the second part of our three-part "Media Beat" interview with him, Frank Rich talks about leaving The New York Times to join New York magazine, ...

34% Rate Obama’s Handling of Government Spending As Good or Excellent
Voters continue to question President Obama's handling of issues related to government spending and taxes. A new Rasmussen Reports national telephone ...

Resources last updated: 12/26/2015 4:18:52 PM