Quantcast
Channel: Visual Studio Report Controls Forum
Viewing all articles
Browse latest Browse all 519

C# Help

$
0
0

Hi,

i am fairly new to c# and am trying to create a student registration system. I have created a login page and linked it to an sql database which i have also created although i am getting a few errors could you help? The code i have so far is below. The error comes on the con.open(); line, where i get the invalidoperationexception was unhandled error message.

using

System;


using

System.Collections.Generic;


using

System.Linq;


using

System.Windows.Forms;


using

System.Data.SqlClient;


using

System.Configuration;

 


namespace

SRS1

{

   

staticclassProgram


    {

       

///<summary>


       

///The main entry point for the application.


       

///</summary>


        [

STAThread]

       

staticvoidMain()

        {

           

Application.EnableVisualStyles();

           

Application.SetCompatibleTextRenderingDefault(false);

           

Application.Run(newLogin());

        }

       

publicstaticSqlConnectionGetConnection

        {

           

get


             {

               

stringConnectionString = ConfigurationManager.ConnectionStrings["student1"].ConnectionString;

               

SqlConnectioncon = newSqlConnection(ConnectionString);

                con.Open();

               

returncon;

              }

        }

         

publicstaticstringStudentInfoUsername {get; set;}

    }

}



Viewing all articles
Browse latest Browse all 519


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>