Hey All,
I am using WinForms & C# to access a SQL Server 2008 on my site which's hosted by winhost.com.
I am using the following code to connect to the database, which I figured out for myself:
try
{
SqlConnection scon = new SqlConnection(
"My ConnectionString Info is in here.");
scon.Open();
MessageBox.Show(scon.Database);
cd = true;
}
catch (Exception exception)
{
MessageBox.Show(exception.Message + "\n" + exception.StackTrace);
}
And it connects to the database perfectly everytime. So, what I anm having trouble doing is (My database on the winhost servers is blank.) adding rows and columns to it, so i can add info later... I would like to use LINQ for this.
I have seen so many tuts online but they all seem so geared towards using a local database and then uploading it! Or using a service! But all I want to do is simply establish a connection, and send a command, something like so:
- Establish Connection with Remote SQL Server.
- Add Rows/Columns.
- Terminate Connection.
...And at a later point:
- Establish connection.
- Do a tiny search for something in Row X.
- Get value of Match in Row X.
- Terminate Connection.
I would really appreciate your help on this. I know it can be done. I know I've seen articles on this before but it was last year and I didn't need to access a database back then.
MSDN, WindowsCLient and Google have proved to be useless when trying to get the information that I require this time.
Thank you