dobby

dobby

  • NA
  • 53
  • 0

Please assist with Sql and Access issue.

Jul 7 2008 3:35 PM
     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.

Answers (3)