I have a project of C++ windows form. Now, I want to store the data in my SQL server database. So, how can I connect my database from inside my C++ code and how to write an insert query?
I used the following code but it throws an exception that cannot open or cannot found the database.
SqlConnection^ con = gcnew SqlConnection();
int i = 0;
con->ConnectionString = "Data Source=122.179.151.229\EIEXPRESS;Initial Catalog=ICAST_IMS;Uid=developer;pwd=dev@12345";
con->Open();
SqlCommand^ com = gcnew SqlCommand();
com->Connection = con;
com->CommandText = "INSERT INTO image_analysis (nodule_count, nodularity) VALUES (final_nodule_count, 'final_nodularity')";
com->ExecuteNonQuery();