15,890,512 members
Sign in
Sign in
Email
Password
Forgot your password?
Sign in with
home
articles
Browse Topics
>
Latest Articles
Top Articles
Posting/Update Guidelines
Article Help Forum
Submit an article or tip
Import GitHub Project
Import your Blog
quick answers
Q&A
Ask a Question
View Unanswered Questions
View All Questions
View C# questions
View C++ questions
View Javascript questions
View Visual Basic questions
View Python questions
discussions
forums
CodeProject.AI Server
All Message Boards...
Application Lifecycle
>
Running a Business
Sales / Marketing
Collaboration / Beta Testing
Work Issues
Design and Architecture
Artificial Intelligence
ASP.NET
JavaScript
Internet of Things
C / C++ / MFC
>
ATL / WTL / STL
Managed C++/CLI
C#
Free Tools
Objective-C and Swift
Database
Hardware & Devices
>
System Admin
Hosting and Servers
Java
Linux Programming
Python
.NET (Core and Framework)
Android
iOS
Mobile
WPF
Visual Basic
Web Development
Site Bugs / Suggestions
Spam and Abuse Watch
features
features
Competitions
News
The Insider Newsletter
The Daily Build Newsletter
Newsletter archive
Surveys
CodeProject Stuff
community
lounge
Who's Who
Most Valuable Professionals
The Lounge
The CodeProject Blog
Where I Am: Member Photos
The Insider News
The Weird & The Wonderful
help
?
What is 'CodeProject'?
General FAQ
Ask a Question
Bugs and Suggestions
Article Help Forum
About Us
Search within:
Articles
Quick Answers
Messages
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