.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
david stephan
Gaurav Pal
Post New Web Links

How do you use an ODBC database?

Posted By:      Posted Date: September 03, 2010    Points: 0   Category :ASP.Net
I have been developing my ASP.NET web pages to access the SQL database locally on my personal computer while using a "SqlConnection", but to access my SQL database on a host server, I must use a "OdbcConnection".  I am mostly using LINQ to access data with a DataClassesDataContext, but sometimes I must use ADO with SqlConnection and SqlCommand.  What must I do to convert my C# code in order to access data with ODBC 3.51?   Maurice Osborn

View Complete Post

More Related Resource Links

Configuring ODBC Database connection in Sharepoint Designer 2010


We are trying to connect the simple way from Sharepoint Designer 2010 to an external Pervasive SQL version 10 database.

Normally this is a trivial excercise in any other development tool, you supply an ODBC connection and away you go.

Using Sharepoint Designer 2010 (or the previous version) it is not possible to get a working connection that will get you past the "Configure Database Connection" dialog. We have to use the "Use custom connection string option" as that is the only place there appears to be a Provider for ODBC or OleDB.

No connection string works, I have tried connection strings that work fine in Visual Studio, no joy.



How can I query blob columns from Paradox database via ODBC?



I want to read blob columns from Paradox database using c#. Here is my code:

  DataSet dsUsers = new DataSet();

  string strQuery = "SELECT blobColumn FROM users";

  dsUsers = GetNames(strQuery, "Driver={Microsoft Paradox Driver (*.db )}; Default Dir=<directory>;DBQ=<directory>");

 private DataSet GetNames(String strQuery, String strConnect)


  DataSet dsNames = new DataSet();



  OdbcConnection conOdbc = new OdbcConnection(strConnect);

  OdbcCommand cmdOdbc = new OdbcCommand(strQuery, conOdbc);

  OdbcDataAdapter odaOdbc = new OdbcDataAdapter(cmdOdbc);





  catch (OdbcException eExc)



  catch (Exception eExc)



  return dsNames;


Note that the Paradox driver version is 4.0.

The code failed to query the blob column.  The error is:

Error code: -2146232009
 Error msg: ERROR [07002] [Microsoft][ODBC Paradox Driver] Too few parameters. Expected 1.
 Source: odbcjt32.dll

Please note that I can query non-blob columns of the table with the same code.

2008 server Access database connecting win7 workstation with ODBC link works extremely slowly


I have an Access database on a 2008 server (64 bit), and notebooks with 32 bit win7. The program using the mdb is written in delphy, and running on my notebook, and working on data extremely slow. What can be the problem?

The database connector is an ODBC linked network drive.

On that same configured PC with XP it works normally.


connecting to sql database with odbc SqlDriverConnect in c++

I am attempting to access an sql database from c++.  I am having trouble successfully establishing a connection to this database.  My code is as follows:

// initialize return code for sql operation status
	RETCODE returnCode;

	// initialize handles
	SQLHENV handleEnvironment;
	SQLHDBC handleConnection;
	SQLHSTMT handleStatement;

	// allocate environment handle
	SQLAllocHandle(SQL_HANDLE_ENV, SQL_NULL_HANDLE, &handleEnvironment);

	// set odbc driver version for environment
	SQLSetEnvAttr(handleEnvironment,SQL_ATTR_ODBC_VERSION,(void *)SQL_OV_ODBC3, 0);

	// allocate connection handle
	SQLAllocHandle(SQL_HANDLE_DBC, handleEnvironment, &handleConnection);

	// connect to database
	ret = SQLDriverConnect(handleConnection, NULL, (SQLWCHAR*)"DRIVER={SQL Native Client};SERVER=MyComputerName;DATABASE=MyDatabaseName;Trusted_Connection=yes;", SQL_NTS, NULL, 0, NULL, SQL_DRIVER_NOPROMPT);
	// report status
	cout << ret << &quo

ODBC: My Database missing in list of default databases


Hello everybody

I have the following problem:

When creating a new ODBC data source to an SQL Server 2k5 I want to change the default database from 'master' to my database 'addresses'.

However my database 'addresses' doesn't appear in the drop down list.

I'm conneting with the 'sa' account.

I've activated all protocols in the SQL Server Configuration Manager.

What shall I do?


Any help is greatly appreciated.



Multiple database support with Entity Framework

One of the features introduced in Entity Framework is being database independent. Which mean each database provider can support Entity Framework by implementing its provider.

This feature allows you build applications independent from the underplaying database provider. In this post I'm going to show how to build an application that support multiple databases using same conceptual model made by Entity Framework.

Export Visio Database Table Names to Excel

If you use the Enterprise Architect edition of Microsoft Visio for data modeling regularly, then there is a good chance that at some point you've wanted to export just the table names into Excel. You might want to do this to map logical ERD entities to physical data model tables, track project status by entity, or track overlap between database versions.

MS SQL Server: Disconnect Users From Database - Kill User Session

If you ever wanted to restore your database from a SQL backup file (.bak), but there are still users connected to your database, the backup operation will fail causing the error: Exclusive access could not be obtained because the database is in use.

Publishing SQL Server Database using Publishing Wizard : Tips & Tricks

We can use SQL Server Publishing Wizard to deploy our local Database to remote hosting server/production server.This feature is available in SQL Server 2008/VWD 2008.

Below is the complete step by step guide of this process.

Adding Rows in GridView without using a Database

This article describes on how to add rows in GridView without using a database. Basically the GridView will be populated with data based on the values entered in the TextBox on Button Click and retain the GridView data on post back.

Adding Multiple Columns and Rows in GridView without using a Database

This article describes on how to add multiple columns and rows in GridView without using a database. Basically the GridView will be populated with data based on the values entered in each TextBoxes on Button Click and retain the GridView data on post back.

ASP.NET Database Tutorial

This tutorial will show you how to display data using the .NET GridView Control, ASP.NET 2.0 and VB.NET

The GridView control is a powerful tool and is simple to implement.

First, you will need to import the System.Data.SqlClient namespace.

Connestion string create any database server

This links important to how to create connection string to any data base sever.

SQL Server Database Transaction

A transaction is a group of SQL commands executed together as a single component of work to be accomplished. If all of these commands succeed, then a transaction is committed - the changes to the data are made final. If any of the commands within a transaction fail, then the entire transaction is cancelled, or in SQL Server terms, the transaction will be rolled back.

Transactions are one of the things that keep your data safe, but they're not necessarily easy to understand. Here's some help:

Database Export Wizard for ASP.net and SQL Server

A step wizard for ASP.net to export database objects to CSV, TXT, HTML, XML, or SQL. it guides users through a few simple steps to choose a database object (table, view, or query), select columns, and export the data in any of the standard formats CSV, HTML, XML, or SQL.

Reading and Writing Images From a Windows Mobile Database using UltraLite 10(C#)

Periodically I get a request for information on how to read and write binary data to a database running on Windows Mobile. If you search the Internet you can typically find examples that are available on Windows Desktops or allow you to read and write to a local file system. The problem is that it can take a bit of work to get this code to work on Windows Mobile accessing a database.

Ultimately you might be asking, why would I want to store and image in a database? Well in an environment where you synchronizing data between a local mobile database and a consolidated (central) database this can be extremely useful. Imagine if an insurance adjuster went to an accident scene, took a picture of a damaged car, loaded it into his Windows Mobile database and then replicated that image up to the Insurance headquarters for approval. All of this could be done in a very short period of time when using images in the database. Another good example might be a doctor who was waiting for a patient chart to become available. If you could store the image in a database this chart could be sent down to the doctor's device once it became available.

For this article I am not going to get into how to synchronize the images to and from a remote and central database as this is typically fairly straightforward when using a data synchronization technologies like MobiLink

Store and Display Images from MS Access Database Using C#

There is only the difference of coding syntax to stream the binary data of image content type to upload it into MS Access Database using C#/VB in ASP.Net 2.0

Namespaces required:-
using System.Data.OleDb;

OleDb is used to connect the web site forms with MS Access Database using Microsoft.Jet.OLEDB.4.0
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend