as

Showing posts with label Databases. Show all posts
Showing posts with label Databases. Show all posts

Wednesday, 26 February 2014

data type mismatch in criteria expression in ms access

Problem / Error:

When you try to access the data from the Microsoft Access database from any language like C#, VB.Net, VB6 etc, You may encounter the error saying - data type mismatch in criteria expression .
This happens when you are executing the query involving the column with data type set as Date/Time in access database.

For example -Consider below query.

Select * from student where joining_date = '12-01-2013' 

Executing above query will give you the error saying data type mismatch in criteria expression.

Solution:
To fix above issue, you will have to re-write the query as mentioned below.

Select * from student where joining_date = #12-01-2013#

Thus we have to use # at the start and end of the date value. This will fix the issue.


What do you think on this topic? Please express your opinion through comment below. You can write to me at reply2sagar@gmail.com

Wednesday, 5 February 2014

Ms access provider not displaying in ODBC manager in windows 7 64-bit OS

Problem

When we try to create a DSN in windows 7 with 64 bit, the drivers for the microsoft access is not visible.
Only sql server drivers are displayed.


Solution

To solve this issue you must launch the ODBC driver dialog window using below exe file.
c:\windows\sysWOW64\odbcad32.exe

When you open the ODBC manager from above exe file, all 32-bit drivers are displayed including ms-acess (.mdb and .accdb ) and you can create a dsn for access database.


What do you think on this topic? Please express your opinion through comment below

Saturday, 18 January 2014

How to create DSN to connect to Sql Server Database

Hello guys -  You can create DSN for the sql server Databases using below steps
  1. Open Control Panel
  2. Click on Administrative tools
  3. Select Data Sources (ODBC)
  4. DSN Configuration window Opens as shown below.

After you get this window, follow below steps.
  1. Select System DSN Tab and click on Add button
  2. You will see below window where you will have to select a database provider.


In this window you have to select provider corresponding to your database. As we want to connect to sql server database, I have selected "sql server".

Next you have to give the name for dsn and provide sql server name. Then click on next




Next screen you will be asked for the user id and password. If you are using windows authentication mode, you don't need to do anything on this screen. Click next.


Then you have to click on next and finally you can test your data source as well
You should see below message on the final window.


You are done. Now You can access your database from any language using this dsn name.


What do you think on this topic? Please express your opinion through comment below

How to create a DSN for microsoft access database?

Hello guys -  Whenever you need to connect to database, we need to provide the connection strings.
I usually prefer creating DSN for the Databases that I want to access and then use that DSN in code. This makes coding look very simple.

You can follow below steps for creating DSN.

  1. Open Control Panel
  2. Click on Administrative tools
  3. Select Data Sources (ODBC)
  4. DSN Configuration window Opens as shown below.

After you get this window, follow below steps.
  1. Select System DSN Tab and click on Add button
  2. You will see below window where you will have to select a database provider.


In this window you have to select provider corresponding to your database. As we want to connect to access database, I have selected "Microsoft access driver".

Next you have to give the name for dsn and browse to the access file and click on Ok


You are done. Now You can access your database from any language using this dsn name.


What do you think on this topic? Please express your opinion through comment below

Sponsored Links

Popular Posts

Comments

ShareThis