TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Samia Souror
NA
33
5.1k
How to get value from sting array and use it ?
Nov 26 2018 4:15 PM
Welcome,
I have string array hold some keys used to decrypt column data in the database. but only the first value in the column is decrypted correctly.
private void button8_Click(object sender, EventArgs e)
{
this.txtKey.Hide();
this.lblkey.Hide();
OracleConnection conn;
using (conn = new OracleConnection(oradb))
{
OracleCommand select = new OracleCommand("select EMPNO, ENAME,JOB from EMP", conn);
conn.Open();
OracleDataReader reader = select.ExecuteReader();
Int64 v_empno = 0;
String v_JOBvalue = "";
String Decryptjob = "";
Enigma enigma = new Enigma();
if (reader.HasRows)
{
foreach (var item in KeyList)
{
int i = 0;
string[] the_array = new string[KeyList.Count];
while (reader.Read())
{
v_empno = reader.GetInt32(0);
v_JOBvalue = reader.GetString(2);
the_array[i] = item.ToString();
Decryptjob = enigma.Decrypt(v_JOBvalue, the_array[i]);
// MessageBox.Show(" : value of job :" + v_JOBvalue + "decrypted using the key " + decryptedListKey);
/////////////////////////////////////////////////////////////////////////////////
OracleCommand update = new OracleCommand("update EMP set JOB =:JOB where EMPNO =:EMPNO", conn);
OracleParameter JOB = new OracleParameter("JOB", Decryptjob);
OracleParameter EMPNO = new OracleParameter("EMPNO", v_empno);
update.Parameters.Add(JOB);
update.Parameters.Add(EMPNO);
update.ExecuteNonQuery();
i++;
}}
MessageBox.Show("User updated!");
OracleDataAdapter a = new OracleDataAdapter("select * from EMP", conn);
DataTable t = new DataTable();
a.Fill(t);
dataGridView1.DataSource = t;
reader.Close();
} } }
Reply
Answers (
5
)
assigning i,j ,k to produce true, true and true
Binding json data to html table input filed as hortizontal l