问题描述
大家好,
我是刚开始使用C#的人,也是oracle.我正在c#上开发电话簿.我正在使用Oracle DB.我已经完成插入,删除,搜索.但是,我无法更新信息.请帮我.这是我的第一个问题.抱歉,我的无知.
我在网格表上列出了记录.然后,我双击网格表上任何记录的左侧.然后打开填充当前记录信息的更新面板.直到这里都没有问题.但是我的更新按钮不起作用.
这是我的更新按钮代码.
OracleConnection con = 新 OracleConnection(" 数据源= O10G;用户ID = plsql_staj;密码= *****;" ); con.Open(); 字符串查询= " UPDATE TEL_REHBERI SET AD ='" + txtGnclAd.Text.ToUpper()+ " ',SOYAD ='" + txtGnclSoyad. Text.ToUpper()+ " ',YAS ='" + txtGnclYas.Text.ToUpper()+ " ',CEP_NO ='" + txtGnclCep.Text.ToUpper()+ " ',EV_NO ='" + txtGnclEv.Text.ToUpper()+ " ',DOGUMYERI ='" + txtGnclDogumYeri.Text.ToUpper()+ " 'WHERE AD ='" ++ " 'AND SOYAD ='" + txtGnclSoyad.Text.ToUpper()+ " 'AND YAS ='" + txtGnclYas.Text.ToUpper()+ " 'AND CEP_NO ='" + txtGnclCep.Text.ToUpper()+ " 'AND EV_NO ='" + txtGnclCep.Text.ToUpper()+ " 'AND DOGUMYERI ='" + txtGnclDogumYeri.Text. ToUpper()+ " '" ; DataSet ds = 新 DataSet(); // 数据集 OracleDataAdapter da = 新 OracleDataAdapter(query,con); // DataAdapter olustur OracleCommand cmd = 新 OracleCommand(query,con); bool result = Convert.ToBoolean(cmd.ExecuteNonQuery()); da.Fill(ds); // DataAdapteri Kullanarak数据集更新日期 con.Close();
在我的表单中,我使用的是相同的文本框.我将添加两个ss,希望对您有所帮助.
第一个SS:
http://www.imagetoo.com/images/ss1aua.png
第2个SS:
http://www.imagetoo.com/images/ss2vuv.png
我需要帮助. Thanx.
Hi everyone,
I am newly started C# and also oracle. I am developing a phone book at c#. I am Using Oracle DB. I have completed insert, delete, search. However, I cant update the information. Please help me. That is my first question. Sorry for my ignorance.
I list the records on a gridtable. Then I double click the left side of any record on grid table. Then the update panel which is filled the information of the current record is opened. There is no problem until here. However my update button does not work.
Here is my Update Button Code.
OracleConnection con = new OracleConnection("Data Source=O10G;User Id=plsql_staj;Password=*****;"); con.Open(); string query = "UPDATE TEL_REHBERI SET AD ='" + txtGnclAd.Text.ToUpper() + "' , SOYAD ='" + txtGnclSoyad.Text.ToUpper() + "' , YAS = '" + txtGnclYas.Text.ToUpper() + "' , CEP_NO = '" + txtGnclCep.Text.ToUpper() + "' , EV_NO = '" + txtGnclEv.Text.ToUpper() + "', DOGUMYERI = '" + txtGnclDogumYeri.Text.ToUpper() + "' WHERE AD ='"++ "' AND SOYAD = '" + txtGnclSoyad.Text.ToUpper() + "' AND YAS ='" + txtGnclYas.Text.ToUpper() + "' AND CEP_NO = '" + txtGnclCep.Text.ToUpper() + "' AND EV_NO ='" + txtGnclCep.Text.ToUpper() + "' AND DOGUMYERI = '" + txtGnclDogumYeri.Text.ToUpper() + "' "; DataSet ds = new DataSet();// Dataset OracleDataAdapter da = new OracleDataAdapter(query, con); // DataAdapter olustur OracleCommand cmd = new OracleCommand(query, con); bool result = Convert.ToBoolean(cmd.ExecuteNonQuery()); da.Fill(ds); // DataAdapteri Kullanarak Dataset içindeki Verilere erişti con.Close();
In my form I am using the same textboxes. I will Add two ss and hope this will help.
1st ss:
http://www.imagetoo.com/images/ss1aua.png
2nd ss:
http://www.imagetoo.com/images/ss2vuv.png
I need Help. Thanx.
这篇关于如何使用相同的texbox更新数据?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!