473,411 Members | 2,530 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,411 software developers and data experts.

function to build sql update string based upon data type

TJS
looking for generic function to build sql update string for values coming
from a form.
I've seen these for classic asp but I'm not finding equivalent in asp.net

Googleing did not help so far
Nov 19 '05 #1
3 1394
Perhaps the easiest way is by using Microsoft's free Data Application Block.
Here's more info:
http://www.devx.com/codemag/Article/22641

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://SteveOrr.net
"TJS" <no****@here.com> wrote in message
news:OQ*************@TK2MSFTNGP11.phx.gbl...
looking for generic function to build sql update string for values coming
from a form.
I've seen these for classic asp but I'm not finding equivalent in asp.net

Googleing did not help so far

Nov 19 '05 #2
what part is the issue? You should be able to do it the same way really.....

--
Curt Christianson
Site & Scripts: http://www.Darkfalz.com
Blog: http://blog.Darkfalz.com
"TJS" <no****@here.com> wrote in message
news:OQ*************@TK2MSFTNGP11.phx.gbl...
looking for generic function to build sql update string for values coming
from a form.
I've seen these for classic asp but I'm not finding equivalent in asp.net

Googleing did not help so far

Nov 19 '05 #3
TJS


I want to do something like this but don't know how .net gets the datatype
or which type of database connection to use for updating field
======================

strName = vFldname
intType = Cint(objRS(vFldname).Type)
strNewValue = vFldValue

If strName <> "ID" Then 'skip primary key
Select Case intType
Case 2, 3, 4, 5, 6, 17 'number fields
If not IsNumeric(strNewValue) Then strNewValue = Null
Case 11 'yes/no fields
If UCase(strNewValue) = "ON" Then
strNewValue = 1
Else
strNewValue = 0
End If
Case 7,135 'date/time fields
If not IsDate(strNewValue) Then strNewValue = Null
Case Else 'string fields
If Trim(strNewValue) & "" = "" Then strNewValue = Null
End Select

strNewValue = dataPrep(strNewValue)
objRS(strName) = strNewValue

End If
Nov 19 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
by: Douglas Buchanan | last post by:
I am using the following code instead of a very lengthly select case statement. (I have a lot of lookup tables in a settings form that are selected from a ListBox. The data adapters are given a...
3
by: WC Justice | last post by:
I need to build an UPDATE statement that copies the values of roughly 40 fields from a table that stores standard or default values into a table of specific contracts. There are 8 or so fields in...
3
by: T | last post by:
Hi all. I have a problem I have not been able to find a reference about. I am using VB6 and am only a hobbyist programmer. I have 7 arrays of type MyData. Type MyData has 23 elements. Which...
9
by: Dom Boyce | last post by:
Hi First up, I am using MS Access 2002. I have a database which records analyst rating changes for a list of companies on a daily basis. Unfortunately, the database has been set up (by my...
5
by: mike | last post by:
If I have a document like: <script> function mike_test() {alert('hi');} </script> <iframe src="blank.html" id="my_iframe1"> </iframe> and in blank.html I have:
9
by: cmk128 | last post by:
Hi Why put * in front of the function name in the declaration? int (*write)(struct inode *, struct file *, const char *, int); thanks from Peter (cmk128@hotmail.com)
16
by: mdh | last post by:
May I ask the group the following: (Again, alas , from K&R) This is part of a function: while ( ( array1 = array2 ) != '\0' ); /* etc etc */ Is this the order that this is evaluated? ...
3
by: Rico | last post by:
Hello, I have a generic process that logs errors from different sources. When I call this code, I'd like to also submit the name of the function or sub that is raising the error without having...
3
by: siyaverma | last post by:
i am trying to upload csv file from user's computer to main server the code i am using is if(((isset($_GET)) && ($_GET=="yes")) ) { $typefield = $_GET; echo...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.