Lubna1607

I need the c# code that helps me connects the c# interface to the sql server database...please help me out and if the question isnt clear tell me and ill explain it ...thanx Smile
Lubna


Re: .NET Framework Data Access and Storage connecting c# interface to the sql server database

eradicator

Please do some research and ask specific questions if needed.

http://www.google.com/search hl=en&q=%22ado.net%22+tutorial






Re: .NET Framework Data Access and Storage connecting c# interface to the sql server database

QuickTime

Here you go.

Hope this helps:

//Declare the string variable that will contain the connection
string connectionString;

connectionString = Data Source=SAMPServer;Initial Catalog=SampDatabase;User ID=UserName;Password=Password;

// Declare the SqlConnection that will be used to execute the sql commands
SqlConnection connection = new SqlConnection(connectionString);

try
{
// Open the connection
connection.Open();
connection.Dispose();

return true;
}
//catch (Exception error)
catch
{
// No matter what the error is the database is not available so the system will be offline anyway.
// If I want to work with the error message I will switch to catch (Exception error) and investigate error.Message
return false;
}





Re: .NET Framework Data Access and Storage connecting c# interface to the sql server database

Lubna1607

Thank you all for your help Smile