Prudhvi Raj

Prudhvi Raj

  • NA
  • 17
  • 1.4k

cONVERSION FAILED WEN CONVWERTING VARCHAR VALUE HELLO IN TO

May 5 2017 4:47 AM
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Data.SqlClient;
namespace Invoice_Genraton
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
}
private void textBox1_TextChanged(object sender, EventArgs e)
{
}
SqlDataAdapter da;
DataSet ds;
SqlConnection con;
private void btnSubmit_Click(object sender, EventArgs e)
{
con = new SqlConnection("Data Source=localhost;Initial Catalog=allcare;Integrated Security=True;Pooling=False");
da = new SqlDataAdapter("insert into [prudhvi] values('" + textBox1.Text + "','" + textBox2.Text + "','" + textBox3.Text + "','"
+ textBox4.Text + "','" + textBox5.Text + "','" + textBox6.Text + "','" + textBox7.Text + "','" + textBox8.Text + "','" +
textBox9.Text + "','" + textBox10.Text + "','" + "')", con);
ds = new DataSet();
da.Fill(ds);
Form2 f2 = new Form2();
this.Hide();
f2.label12.Text = textBox1.Text.ToString();
f2.label13.Text = textBox2.Text.ToString();
f2.label14.Text = textBox3.Text.ToString();
f2.label15.Text = textBox4.Text.ToString();
f2.label16.Text = textBox5.Text.ToString();
f2.label17.Text = textBox6.Text.ToString();
f2.label18.Text = textBox7.Text.ToString();
f2.label19.Text = textBox8.Text.ToString();
f2.label20.Text = textBox9.Text.ToString();
f2.label21.Text = textBox10.Text.ToString();
int n1 = int.Parse(textBox9.Text);
int n2 = int.Parse(textBox10.Text);
int total = n1 + n2;
f2.label22.Text = total.ToString();
f2.Show();
}
}
}

Answers (5)