Click here to Skip to main content
15,890,512 members

Comments by suryatejaambati (Top 2 by date)

suryatejaambati 21-Jul-14 19:00pm View    
Deleted
Hope you better know criticism than solving. Thank you for your support.
suryatejaambati 21-Jul-14 18:19pm View    
Here is my code: I didn't ask you without trying by myself.
SqlConnection con = new SqlConnection("server=SURI-PC;Database=OVS;integrated security=true");

string Path = tb_brws.Text;
if (Path == "")
{
//Photo photo = new Photo();
photo.Show();
this.Close();
}
string uid = System.Guid.NewGuid().ToString().Replace("-", "").ToUpper();
tb_uid.Text = uid.ToString();
Random slumpGenerator = new Random(); int tal;
tal = slumpGenerator.Next(00000000, 99999999);
tb_pass.Text = tal.ToString();
string password = tb_pass.Text;
//string repassword = tb_repass.Text;
string valid = cb_Id.SelectedItem.ToString();
string idno = tb_id_no.Text;
string name = tb_name.Text;
string sname = tb_Sname.Text;
string sex = "Male";
string dob = dtp_dob.Text.ToString();
string nation = cb_nation.SelectedText.ToString();
string via = tb_via.Text;
string num = tb_num.Text;
string city = tb_city.Text;
string reg = cb_reg.SelectedItem.ToString();
string country = cb_country.SelectedItem.ToString();
string email = tb_email.Text;
string tel = tb_tel.Text;
string mob = tb_mob.Text;
if (rb_Male.Checked == true)
{
sex = "Male";
}
else
{
sex = "Female";
}
try
{

SqlCommand cmd = new SqlCommand("select * from id_val where id_type ='" + valid + "', idno = '" + idno + "' and sname = '" +sname+ "'");
con.Open();
SqlDataReader dr = cmd.ExecuteReader();
int count = 0;
while (dr.Read())
{
count = count + 1;
}
if (count == 1)
{
//SqlConnection con1 = new SqlConnection("server=SURI-PC;Database=OVS;integrated security=true");
//con.Open();
SqlCommand cmd1 = new SqlCommand("insert into memRegForm (validid, idno, sname) values ('" + valid + "', '" + idno + "', '" + sname +"')", con);
cmd1.ExecuteNonQuery();
SqlCommand cmd2 = new SqlCommand("delete from id_val where id_type = '" + valid + "'", con);
cmd2.ExecuteNonQuery();

}
else
MessageBox.Show("Please Enter a valid Id type and number or you already registered");

con.Close();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}

//SqlConnection con1 = new SqlConnection("server=SURI-PC;Database=OVS;integrated security=true");
SqlCommand cmd3 = new SqlCommand("insert into memRegForm(uid, password, name, sex, dob, nation, via, num, city, region, country, email, tel, mob) values ('" + uid +"', '" +password+ "', '" + name +"', '" + sex +"', '" + dob +"', '" + nation +"', '" + via +"', '" + num +"', '" + city +"', '" + reg +"', '" + country +"', '" + email +"', '" + tel +"', '" + mob +"')", con);
con.Open();
cmd3.ExecuteNonQuery();
con.Close();
try
{
//Read Image Bytes into a byte array
byte[] imageData = ReadFile(tb_brws.Text);

//Initialize SQL Server Connection
//SqlConnection CN = new SqlConnection(txtConnectionString.Text);

//Set insert query
string qry = "insert into imgDb (Path,ImageData) values(@Path, @imageData)";

//Initialize SqlCommand object for insert.
SqlCommand SqlCom = new SqlCommand(qry, con);

//We are passing Origi