Hi, i am trying to make registration form but i kept geting error: CS1513 } expected but i can figure out how to fix it. Thanks in advance!

  • Thread starter Thread starter Phora Mahlatse
  • Start date Start date
P

Phora Mahlatse

Guest
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 RegistrationFormsApp
{
public partial class Form1 : Form
{
string StrConnections = @"Data Source=(LocalDB)\MSSQLLocalDB;AttachDbFilename=C:\Users\fortu\OneDrive\Documents\RegDB.mdf;Integrated Security=True;Connect Timeout=30";
public Form1()
{
InitializeComponent();
textPassword.MaxLength = 8;
}
private void SubmitButton_Click(object sender, EventArgs e)
{
if (textUsername.Text == "" || textPassword.Text == "")
{
MessageBox.Show("Please fill the registration form!");
}
else
{
MessageBox.Show("Password don't match. Try again!");
}
SqlConnection sqlCons = new SqlConnection(StrConnections);

sqlCons.Open();
SqlCommand cmd = new SqlCommand("UserInforInsertor", sqlCons);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.AddWithValue("@Last_Name", textLastName.Text.Trim());
cmd.Parameters.AddWithValue("@First_Name", textFirstName.Text.Trim());
cmd.Parameters.AddWithValue("@Contact", textContact.Text.Trim());
cmd.Parameters.AddWithValue("@Address", textAddress.Text.Trim());
cmd.Parameters.AddWithValue("@UserName", textUsername.Text.Trim());
cmd.Parameters.AddWithValue("@Password", textPassword.Text.Trim());
cmd.ExecuteNonQuery();
MessageBox.Show("The registration is completed!");
Clear();
}
private void Clear()
{
textLastName.Text = textFirstName.Text = textContact.Text = textAddress.Text = textPassword.Text = textConfirmPassword.Text = "";
}
}

}

Continue reading...
 
Back
Top