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 2823
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: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
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
|
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: 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...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
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...
| |