Can anyone help me with this?
public:
String^ name;
String^ cstr;
TreeNode^ tn;
SqlCommand sc;
String^ procedura;
SqlConnection^ cn;
SqlConnectionStringBuilder^ sqb;
private: System::Void STRUKTURA_Load(System::Object^ sender, System::EventArgs^ e)
{
//sqb = gcnew SqlConnectionStringBuilder();
//sqb->DataSource = "ROOT\FENIKS";
//sqb->InitialCatalog = "RC";
//sqb->IntegratedSecurity = true;
cn = gcnew SqlConnection();
cstr = "Data Source=ROOT\FENIKS;Initial Catalog=RC;Integrated Security=True; IsAppSettingsProperty=False; Modifier=Assembly; Name=root\feniks.RC.dbo; ParameterPrefix=@; Provider=System.Data.SqlClient;";
cn->ConnectionString = cstr;
cn->Open();
//cn= gcnew SqlConnection("Data Source=ROOT\FENIKS;Initial Catalog=RC;Integrated Security=True; IsAppSettingsProperty=False; Modifier=Assembly; Name=root\feniks.RC.dbo; ParameterPrefix=@; Provider=System.Data.SqlClient;");
//cn->Open();
}
private: System::Void bt1_Click(System::Object^ sender, System::EventArgs^ e)
{
name = ID_S->Text;
tn = gcnew TreeNode;
tree->Nodes->Add(name);
procedura = "INSERT INTO [RC].[dbo].([IDS])VALUES(<IDS, "+name+",>)";
:
ialogResult result = MessageBox::Show(this,procedura,"Błąd wprowadzanych danych",
MessageBoxButtons::OK,
MessageBoxIcon::Error);
SqlCommand^ con1 = gcnew SqlCommand(procedura,cn);
cn->Open();
con1->ExecuteNonQuery();
cn->Close();
}
AND ERROR THAT APPEARS:
An unhandled exception of type 'System.InvalidOperationException' occurred in System.Data.dll
Additional information: The ConnectionString property has not been initialized.
public:
String^ name;
String^ cstr;
TreeNode^ tn;
SqlCommand sc;
String^ procedura;
SqlConnection^ cn;
SqlConnectionStringBuilder^ sqb;
private: System::Void STRUKTURA_Load(System::Object^ sender, System::EventArgs^ e)
{
//sqb = gcnew SqlConnectionStringBuilder();
//sqb->DataSource = "ROOT\FENIKS";
//sqb->InitialCatalog = "RC";
//sqb->IntegratedSecurity = true;
cn = gcnew SqlConnection();
cstr = "Data Source=ROOT\FENIKS;Initial Catalog=RC;Integrated Security=True; IsAppSettingsProperty=False; Modifier=Assembly; Name=root\feniks.RC.dbo; ParameterPrefix=@; Provider=System.Data.SqlClient;";
cn->ConnectionString = cstr;
cn->Open();
//cn= gcnew SqlConnection("Data Source=ROOT\FENIKS;Initial Catalog=RC;Integrated Security=True; IsAppSettingsProperty=False; Modifier=Assembly; Name=root\feniks.RC.dbo; ParameterPrefix=@; Provider=System.Data.SqlClient;");
//cn->Open();
}
private: System::Void bt1_Click(System::Object^ sender, System::EventArgs^ e)
{
name = ID_S->Text;
tn = gcnew TreeNode;
tree->Nodes->Add(name);
procedura = "INSERT INTO [RC].[dbo].
:
MessageBoxButtons::OK,
MessageBoxIcon::Error);
SqlCommand^ con1 = gcnew SqlCommand(procedura,cn);
cn->Open();
con1->ExecuteNonQuery();
cn->Close();
}
AND ERROR THAT APPEARS:
An unhandled exception of type 'System.InvalidOperationException' occurred in System.Data.dll
Additional information: The ConnectionString property has not been initialized.