When use Oledb c# connection I noticed that a lot connection using file. But how to connect to localhost using oledb? I created database and tables using Microsoft SQL Server Management that connect with SQL Express and using window authentication
When using this function i don't know how should convert to connect to localhost
//Want the connString to connect localhost instead of file
public static string connString = @"Provider=Microsoft.JET.OLEDB.4.0;data source=" + Path + "\\database\\errDB.mdb";
public static OleDbConnection connection;
public myFunction()
{
string sqlString = "SELECT name,contact,accessLevel,Crudential_ID FROM errors where Crudential_ID =@ID";
connection = new OleDbConnection(connString);
OleDbCommand command = new OleDbCommand(sqlString, connection);
//Open connection
connection.Open();
command.Parameters.Add("@ID", OleDbType.VarChar);
command.Parameters["@ID"].Value = "test";
//Read from database
OleDbDataReader reader = command.ExecuteReader();
if(reader.HasRows)
{
.....
}
connection.Close();
}