Connection string example:
Code: Select all
user id=ceadmin;password=***********;host=10.5.56.177;unicode = True;persist security info=True;Pooling=False;found rows=True
Code: Select all
private void ComandConnectionOpen()
{
try
{
Stream contextStream =
Assembly.GetExecutingAssembly()
.GetManifestResourceStream("ceDataSource.Model.ceDataContext" + ProviderPrefix + ".xml");
MappingSource mappingSource = XmlMappingSource.FromStream(contextStream);
DataContext = new ceDataContext(ConnectionString, mappingSource);
DataContext.Connection.Open();
MessageBox.Show("Database connected!");
}
catch (Exception exception)
{
MessageBox.Show("Error!" + exception.Message);
}
}