using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Data.SqlClient;
using System.Collections;
namespace WindowsFormsApplication19
{
public partial class Form1 : Form
string str;
public string CUSTOMERTABLE = "devi";
int i;
string strc00;
public Form1()
InitializeComponent();
CUSTOMERTABLE = "devi";
BasDataSet dataSet = new BasDataSet();
BasDataSetTableAdapters.deviTableAdapter adapter = new BasDataSetTableAdapters.deviTableAdapter();
adapter.Fill(dataSet.devi);
comboBox1.DataSource = dataSet.devi;
comboBox1.DisplayMember = "CustomerId";
}
private void button1_Click(object sender, EventArgs e)
SqlConnection con = new SqlConnection(@"server=CSE-PC; integrated security=true; Database=Bas");
con.Open();
No 1 :condition: if ((comboBox1.Text == "") && (comboBox2.Text == "") && (comboBox3.Text == "") && (comboBox4.Text == "") && (comboBox5.Text == ""))
MessageBox.Show("doesn't store null value");
Else
No 2 :condition:
if ((comboBox1.Text == "") || (comboBox2.Text == "") || (comboBox3.Text == "") || (comboBox4.Text == "") || (comboBox5.Text == ""))
MessageBox.Show("Enter the nessary fields");
If above two condition is failed then I need to check 3rd conditions with database. How can I get this please help me I need to check with database of table of columnname "Phonenum"
No 3 :condition: check 3rd conditions with database
Here my condition is the phonenum is already exist or not.
if (the phonenum is already exist or not.)
MessageBox.Show("this Customerdetails already registered");
MessageBox.show(" Enter New Customerdetails ");
ComboBox1.Text=="";
ComboBox2.Text=="";
.
No 4 :condition: if the above condition is satisfied then go to 4th condition.
SqlCommand cmd1 = new SqlCommand("insert into devi Values('" + comboBox1.Text + "',+'" + comboBox2.Text + "','" + comboBox3.Text + "','" + comboBox4.Text + "','" + comboBox5.Text + "','" + comboBox6.Text + "','" + comboBox7.Text + "')", con);
cmd1.ExecuteNonQuery();
con.Close();
MessageBox.Show("Added Successfully");
And one problem is: I have button as new user
If I click new user I need to create Automatic id in my 1st click starts with C001,C002. After that I am closing my application again I am
Executing means its need to continue with Next value of id i.e. C003,C004
The below condition is create new id with database of table of CutomerID
I have connect with sql connectivity code like in add button but it shows error
How can I get this please tell me
private void Newuser_Click_1(object sender, EventArgs e)
if (i > 0)
int j = i + 1;
strc00 = "C00" + j.ToString();
else
strc00 = "C001";
comboBox1.Items.Add(strc00);
i++;
MessageBox.Show("id created");