hi i have tried to connect and write to an access database using a Sql connection string. with no success, i dont know what else to say, the source is below. it keeps giving me unknown provider, i have also tried using oledb but to no success (kept getting problems with Not all agruments present or something)
{
SqlConnection sqlClient = new SqlConnection(@"Provider=Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Users\yourname\Documents\ClientBrowser\Clients.accdb;");
SqlCommand cmd = new SqlCommand();
cmd.CommandType = CommandType.Text;
cmd.CommandText = String.Format("INSERT Clients (ClientName, Wage) VALUES ({0}, {1})", txtName.Text, int.Parse(txtWage.Text));
cmd.Connection = sqlClient;
sqlClient.Open();
cmd.ExecuteNonQuery();
sqlClient.Close();
MessageBox.Show("done");
}
many thanks, im sorry if it is a dumb question, but really, im new.
Loading
dobbyPosted Aug 5, 2008, 4:44 PM
Vijaya KadiyalaPosted Aug 5, 2008, 4:19 PM
Hi,
In simple words i would say try using .mdb file format and write simple insert statement as opposed to bind variable query. If this is not working then try out with the connection string spefified in the above post. If you are using new features of MSAccess like BLOB and things like that then you can think of using .accdb otherwise you can go ahead with .mdb.
Thanks -- Vj
http://dotnetvj.blogspot.com
Niradhip ChakrabortyPosted Jul 7, 2008, 4:46 PM
Check out the following tutorial. It will help you out.
http://www.beansoftware.com/ASP.NET-Tutorials/Connecting-Access-SQL-Server.aspx