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
PRASANTA BISWAS
NA
27
9.1k
Record is not reading end of
Mar 26 2014 12:50 AM
Hello all
I am trying to compare two values like PreValue and CurValue. If two values are not same then it will add into a table else skip. But I am not getting what happen. After first record checking it's come out from loop. Anybody help me.
private void AEADT()
{
string[] FieldValue = new string[] { "FaName","MoName","Address","HasAE","Misuse" };
string[] CurValue = new string[] { txtFaName.Text, txtMoName.Text, txtAddress.Text, txtHasAE.Text, txtMisuse.Text };
SqlConnection Con = new SqlConnection("Data Source=192.168.51.12;Initial Catalog=AdverseEvents;Integrated Security=True");
Con.Open();
string PreValue = "Select FaName, MoName, Address, HasAE, Misuse from SCVBAE where FormSL='" + txtFrmSerial.Text.Trim() + "' AND PID='" + txtPID.Text.Trim() + "'";
SqlCommand Com = new SqlCommand(PreValue, Con);
SqlDataReader rd = Com.ExecuteReader();
try
{
AEProperty Add = new AEProperty();
Add.FormSl = txtFrmSerial.Text.Trim();
Add.PID = txtPID.Text;
for (int i = 0; i < FieldValue.Length; i++)
{
if (rd.FieldCount > 0)
{
while (rd.Read())
{
if ((rd.ToString()).Equals(CurValue[i].ToString()) == false)
{
Add.PreValue = rd[i].ToString();
Add.CurValue = CurValue[i].ToString();
Add.FieldName = FieldValue[i].ToString();
Add.FileNo = "1";
Add.ReasonADT = "Punching error";
Add.UpdateBy = Program.EnterBy;
Add.UpdateDt = DateTime.Today.ToString("MM/dd/yyyy");
Add.UpdateTm = DateTime.Now.ToString("HH:mm:ss tt");
DSDBHandler AddHandler = new DSDBHandler();
AddHandler.AddADT(Add);
}
}
}
}
}
catch (Exception ex)
{
MessageBox.Show("Record cannot insert ! check properly" + ex.Message);
txtFrmSerial.Focus();
}
//}
}
Reply
Answers (
2
)
real-time stock quotes
.Net Compilation, registry accessing and application deploym