Can someone please help me with the following problem. I am trying to create a program in .NEt 2003 which connects to a database table in SQL server Express 5. However, after connecting to the local server, I then try to run the program and when I try to view the table in SQL express I get a 'System.NullreferenceException' and when I view the debug details it says that 'object reference is not set to an instance of an object' which am uncertain how to correct.
I have added a connection object which is initialsied with the address of the datable in SQL. Please find below the code that I am using showing the initialised connection object and also the table being called in 'button6' control.
I would greatly appreciate any help....thanks
using
namespace
{
SqlDataAdapter MyAdapt;
InitializeComponent();
}
components.Dispose();
#region
System.Resources.ResourceManager resources =
"RMAN\\SQLEXPRESS\";persist security info=False;initial catalog=MovieDBase";
"Horror",
"Comedy",
"Family/Entertainment",
"Drama",
"Boxsets",
"Sci -fi/Fantasy"});
"Table 1]";
" Director) VALUES (@Param1, @Param2, @Genre, @Param3, @Director); SELECT [Item N" +
"umber], [Movie Title], Genre, [Date of Release], Director FROM [MovTable 1]";
#endregion
[STAThread]
Application.Run(
MessageBox.Show("///Under Construction");
MessageBox.Show("There is currently no movie count available");
Form2 F2 =
sqlConnection1.Open();
MyAdapt.Fill(MDSet, "MovTable 1");
F2.dataGrid1.DataSource = MDSet;
sqlConnection1.Close();