Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > SQL SERVER Connection problem VC++

Reply
Thread Tools

SQL SERVER Connection problem VC++

 
 
Vigerus Vigerus is offline
Junior Member
Join Date: Nov 2009
Posts: 1
 
      11-29-2009
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].[S]([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.
 
Reply With Quote
 
 
 
 
ExpertPractice ExpertPractice is offline
Junior Member
Join Date: Jan 2010
Posts: 7
 
      01-15-2010
Actually i am not a C++ guy but can you confirm you are using the right connection string.

Link: connectionstrings.com
its one of the best source to get all types of connection strings.

i hope this will help

@li
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Help. Getting a An error has occurred while establishing a connectionto the server. When connecting to SQL Server 2005, this failure may be causedby the fact that under the default settings SQL Server does not allow remote aboutjav.com@gmail.com ASP .Net 0 05-03-2008 12:43 PM
SQL Server does not exist after moving to new Sql Server Geoff ASP .Net 3 01-16-2006 05:54 AM
Do the Self-Paced Training Kits: Microsoft SQL Server 2000 include Eval copy of SQL Server? Brian Whiting Microsoft Certification 2 12-29-2005 04:24 AM
sql server express vs sql server 2000 code Daves ASP .Net 1 06-13-2005 12:24 PM
Can't connect to SQL Server, using Windows Authentication users of SQL server? help =?Utf-8?B?UmV6YQ==?= ASP .Net 3 06-07-2004 06:42 PM



Advertisments