contactClass error on Add button

Jun 25 2020 1:03 PM
I have a winform that is connected to 2 databases. One database is to display data in a combobox and the other is to save the data form the winform application. I created a parkingClass.cs, then double clicked the add button to write the script. When I type contactClass c = new contactClass(); I get an error (last line of code below). I hover over the error to get recomendations to correct the error but "using ParkingForm.parkingClasses;" does not appear in the list of option to correct the issue. How do I resolve the error?
  1. using System;  
  2. using System.Collections.Generic;  
  3. using System.ComponentModel;  
  4. using System.Data;  
  5. using System.Drawing;  
  6. using System.Linq;  
  7. using System.Text;  
  8. using System.Threading.Tasks;  
  9. using System.Windows.Forms;  
  10. using System.Data.SqlClient;  
  11. namespace Parking  
  12. {  
  13. public partial class ParkingForm : Form  
  14. {  
  15. SqlConnection con = new SqlConnection("Data Source=CAD;Initial Catalog=Reporting_System;Persist Security Info=True;User ID=sa;Password=***********");  
  16. public ParkingForm()  
  17. {  
  18. InitializeComponent();  
  19. }  
  20. private void ParkingForm_Load(object sender, EventArgs e)  
  21. {  
  22. try  
  23. {  
  24. con.Open();  
  25. SqlCommand sc = new SqlCommand("select Emp_Name from Personnel where JurisdictionID = 99 order by Emp_Name asc", con);  
  26. SqlDataReader reader;  
  27. reader = sc.ExecuteReader();  
  28. DataTable dt = new DataTable();  
  29. dt.Columns.Add("Emp_Name"typeof(String));  
  30. dt.Load(reader);  
  31. Dispatcher.ValueMember = "Emp_Name";  
  32. Dispatcher.DataSource = dt;  
  33. con.Close();  
  34. }  
  35. catch (Exception)  
  36. {  
  37. }  
  38. }  
  39. private void label6_Click(object sender, EventArgs e)  
  40. {  
  41. }  
  42. private void Savebtn_Click(object sender, EventArgs e)  
  43. {  
  44. contactClass c = new contactClass();  
  45. }  
  46. }  
  47. }  

Answers (2)