I konw that one can make use of the default UpdateCommand in the DataAdapter
to save changes back into the underlying data source.
But i was wondering how one could build a custom update command & set this
into the DataAdapter & when the Update method of the Data Adapter is issued,
then this update command should be used.
Esp, if the table is Customer with the following fields,
ID = Primary Key Field (Integer)
Name = Varchar
Male = Bit
UpdateCmd = "UPDATE Contacts SET Name=@Name, Male=@Male WHERE ID=@ID"
But to do this, i need to add the parameters into the update command of the
format,
UpDataCmd.Parameters.Add("@Name", <Column Data Type>, <Column Size>, "Name")
UpDataCmd.Parameters.Add("@Male", <Column Data Type>, <Column Size>, "Male")
UpDataCmd.Parameters.Add("@ID", <Column Data Type>, <Column Size>, "ID")
Now, is there a way i could determine the above,
the Data Type of the columns (SQL Data type) & the Size of the fields (in
the SQL Table).
I don't mind querying the data base to get this info).
Thanx,
Neo 1 2829
Basically what i need is a way of determining the SQL Data type of a column
& the Size of a column.
I found one way of doing this, but may not be the best (then again, this is
what i could comeup with),
I make use of the SQLCommandBuilder class to build the Update command,
& using this generated Update Command, i loop through the Parameters
collection,
& from there i determin the SQLDataType & the size of the field (from the
Parameter object attributes).
Neo
"Neo" <ne*@learning.net> wrote in message
news:#W**************@TK2MSFTNGP14.phx.gbl... I konw that one can make use of the default UpdateCommand in the
DataAdapter to save changes back into the underlying data source. But i was wondering how one could build a custom update command & set this into the DataAdapter & when the Update method of the Data Adapter is
issued, then this update command should be used.
Esp, if the table is Customer with the following fields, ID = Primary Key Field (Integer) Name = Varchar Male = Bit
UpdateCmd = "UPDATE Contacts SET Name=@Name, Male=@Male WHERE ID=@ID" But to do this, i need to add the parameters into the update command of
the format,
UpDataCmd.Parameters.Add("@Name", <Column Data Type>, <Column Size>,
"Name") UpDataCmd.Parameters.Add("@Male", <Column Data Type>, <Column Size>,
"Male") UpDataCmd.Parameters.Add("@ID", <Column Data Type>, <Column Size>, "ID")
Now, is there a way i could determine the above, the Data Type of the columns (SQL Data type) & the Size of the fields (in the SQL Table). I don't mind querying the data base to get this info).
Thanx,
Neo
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Gordon Watts |
last post by:
Hi there,
I've got a special header file which I run an small external program
over to produce a .cpp file that I want to have my project build. The
special header file includes a second header...
|
by: Neo |
last post by:
I konw that one can make use of the default UpdateCommand in the DataAdapter
to save changes back into the underlying data source.
But i was wondering how one could build a custom update command &...
|
by: Peter Ritchie |
last post by:
In VS/VC 2003:
Simple question: for the Custom Build Step for the project (right click the
project in the Solution Explorer, select "Properties", select the "Custom
Build Step" in the...
|
by: Darren |
last post by:
hi y'all!
i pretty much wanted to do a custom form where users can change their
password to the database as they like..
the problem i encountered is that it seems that when a valid user enter...
|
by: Al |
last post by:
Hi all
We have created a xml file that imports a single project using the Import
element. This project compiles to a class library, but has references to two
other projects that are also class...
|
by: Michael Russell |
last post by:
Hi,
I'm beginning the process of moving some projects from VS.Net 7 to
VS2005. I'm having problems getting a Custom Build Step to work.
In the dialog for the header file I want to perform the...
|
by: AlexZh |
last post by:
Hi, I'd like to stop command line build by one project build failed.
To do that I've created simple AddIn (see code below), that works fine
for IDE and does not work for command line.
In the AddIn...
|
by: Michael Russell |
last post by:
Hi all,
Sorry for the repost, but I never received any response when I first
asked this a few weeks ago. I would really appreciate some feedback on
this, it's driving me nuts...
I'm...
|
by: mauro |
last post by:
Hi all,
I am trying to make a package distribution containing some extension
module written in C. The problem is that when I run setup.py some
files are generated in the wrong position.
Suppose...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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...
|
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,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
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...
|
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: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |