473,404 Members | 2,170 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,404 software developers and data experts.

Database Gateways in C#

Hi every one i made a database gateways to access multiple database with Oledb I have made Insert() Select() Delete()

but there is some problem in Update I am giving my Update code and their method of using
but i am not able to decide how user will give fields ant its value and type send foe updation

public void UpdateData(string DatabaseProvider, string DatabaseName, string TableName,Dictionary<string ,string> DC,string Condition)
{
string kk = null;
int i = 0;
foreach (KeyValuePair<string, string> jj in DC)
{
kk = kk + jj.Key + "=" + jj.Value ;
if (i == DC.Count- 1)
continue;
kk = kk + ",";
i++;
}

string ss = "Use " + DatabaseName + " update " + TableName + " set " + kk + Condition ;
if (ocon.State == ConnectionState.Closed)
{
ocon.Open();
}
ocmd = new OleDbCommand(ss, ocon);

try
{
int aa= ocmd.ExecuteNonQuery();
if (aa >0)
{
MessageBox.Show("Record Successfully Updated");
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}

}

How To use on button click

ConnectionManager cm = new ConnectionManager("SQL");
Dictionary<string,string > DC = new Dictionary<string,string>();
DC.Add("Price", "290");
DC.Add("High", "80000");
string condition = " where Symbol = 'CXD'";
cm.UpdateData("SQL", "info", "TBuyOrder", DC, condition);

but problem is that the dictionary i make it is string type if user input DateTime ,Double,or anyother type then How we Recognize in our function
any one can help me to solve this

Thanks
Jun 23 '10 #1
0 940

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Katherine Hall | last post by:
I am looking into using osCommerce package and I wanted to get an idea of what the pros and cons for the different 'payment gateways' they have. I am looking to sell courses online (automatic...
0
by: Cherrish Vaidiyan | last post by:
sir, The following are the steps that i followed in setting up standby database on Red hat Linux 9. i am using Oracle 9i. i have followed the steps in this site : ...
6
by: Marvin Libson | last post by:
Hi All: I am running DB2 UDB V7.2 with FP11. Platform is Windows 2000. I have created a java UDF and trigger. When I update my database I get the following error: SQL1224N A database...
8
by: Kamlesh | last post by:
Hi, How do I know the physical database path of a database. When I goto the DB2INSTANCE users's directory (/home/db2inst1), I see following folders: /db2inst1/NODE0000/SQL00001...
1
by: pintur | last post by:
The message is: SQL1036C Errore di I/O durante l' accesso al database. SQLSTATE=58030 what is the proble? what for restore tables? thanks
3
by: josh.kuo | last post by:
Sorry about the subject, I can't think of a better one. I recently wrote some PHP classes that I think might be of interest to this group. Since I have been reaping the benefits of reading news...
7
by: windandwaves | last post by:
Hi Folk Do you have any recommendations about payment gateways. I know that this is a bit off topic, but I would like to know if you have come accross any that are particular good value for...
5
by: Marijn | last post by:
Hello everybody, I am new to PHP and working on extending my knowledge of OOP. The posts in this group concerned with whether or not to use an OO approach when programming in PHP is not what I...
1
by: Travis1012 | last post by:
Hi, I require a shopping cart which gathers infomation from customers on what they wish to purchase (all products show a price with them). After they have created their list, they go to the cart...
1
by: Travis1012 | last post by:
Hi, I require a shopping cart which gathers infomation from customers on what they wish to purchase (all products show a price with them). After they have created their list, they go to the cart...
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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:
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...
0
Oralloy
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,...
0
jinu1996
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...
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
tracyyun
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 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.