I've looked everywhere on Google to find a fix but I can't a single fix, so. I'm just gonna ask and post my code here and see if anyone can find my problem.
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.Configuration;
namespace Apex6554_MW3_RTM_Tool
{
public partial class Registration : Form
{
SqlConnection con = new SqlConnection(@"Data Source=DESKTOP-S0G9CIH\APEX6654;Initial Catalog=tbl_Register;Integrated Security=True;Pooling=False");
private string connectionString;
public Registration()
{
InitializeComponent();
}
private void button2_Click(object sender, EventArgs e)
{
this.Close();
Form1 back = new Form1();
back.Show();
}
private void SubmitButton_Click(object sender, EventArgs e)
{
using (SqlConnection sqlCon = new SqlConnection(connectionString))
{
if (txtUsername.Text == "" || txtPassword.Text == "")
MessageBox.Show("Please fill mandatory fields");
sqlCon.Open();
SqlCommand sqlCmd = new SqlCommand("UserAdd", sqlCon);
sqlCmd.CommandType = CommandType.StoredProcedure;
sqlCmd.Parameters.AddWithValue("@Email", txtEmail.Text.Trim());
sqlCmd.Parameters.AddWithValue("@Username", txtUsername.Text.Trim());
sqlCmd.Parameters.AddWithValue("@Password", txtPassword.Text.Trim());
sqlCmd.ExecuteNonQuery();
MessageBox.Show("Registration Succesfully !");
Clear();
}
}
void Clear()
{
txtEmail.Text = txtUsername.Text = txtPassword.Text = "";
}
}
}