ERROR [IM002] [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified
I am sharing the code and web.config everything seems to be fine but i am getting an exception when i am filling the datasource.I am getting an exception on the line dtAdapter.Fill(ds)
<add name="Web.Config" connectionString="Data Source=MSONLNP.SR; User
Id=NITE; Password=123;"/>
Imports System
Imports System.IO
Imports System.Data
'Imports System.Data.OracleClient
Imports System.Data.Odbc
Imports System.Data.SqlClient
Imports Microsoft.VisualBasic
Public Class CommonFunctions
'<ObsoleteAttribute("OracleConnection has been deprecated. http://go.microsoft.com/fwlink/?LinkID=144260", False)> Public NotInheritable Class OracleConnection Inherits CommonFunctions Implements ICloneable
'-----------------------------------------------------------------------------
' To Get the SQL Connection
'-----------------------------------------------------------------------------
Public Shared Function getSConnection() As SqlConnection
Dim sqlConnStr As String
sqlConnStr = ConfigurationManager.ConnectionStrings("sqlServerConStr").ConnectionString
Dim sqlConn As SqlConnection = New SqlConnection(sqlConnStr)
Return sqlConn
End Function
'-----------------------------------------------------------------------------
' To Get the Oracle Connection
'-----------------------------------------------------------------------------
Public Shared Function getOConnection() As OdbcConnection
Dim oraConnStr As String
oraConnStr = ConfigurationManager.ConnectionStrings("MsdsOnline").ConnectionString
Dim oraConn As OdbcConnection = New OdbcConnection(oraConnStr)
Return oraConn
End Function
'-----------------------------------------------------------------------------
' To fill the dropdown list
'-----------------------------------------------------------------------------
Public Shared Sub fillDropdrownlist(ByVal sqlQuery As String, ByVal objDropdown As DropDownList, ByVal dtfName As String, ByVal dvfName As String)
Dim oraDA As OdbcDataAdapter
Dim oraDS As DataSet
'----------------------------------
Dim objConn As New System.Data.Odbc.OdbcConnection
Dim objCmd As New System.Data.Odbc.OdbcCommand
Dim dtAdapter As New System.Data.Odbc.OdbcDataAdapter
Dim ds As New DataSet
objConn.ConnectionString = ConfigurationManager.ConnectionStrings("MsdsOnline").ConnectionString
With objCmd
.Connection = objConn
.CommandText = sqlQuery
.CommandType = CommandType.Text
End With
dtAdapter.SelectCommand = objCmd
dtAdapter.Fill(ds)
dtAdapter = Nothing
objConn.Close()
objConn = Nothing
'----------------------------------
oraDA = New OdbcDataAdapter(sqlQuery, getOConnection())
oraDS = New DataSet
oraDA.Fill(oraDS, "AllTables")
objDropdown.DataSource = oraDS
objDropdown.DataSource = oraDS.Tables(0)
objDropdown.DataTextField = oraDS.Tables(0).Columns(dtfName).ColumnName.ToString()
objDropdown.DataValueField = oraDS.Tables(0).Columns(dvfName).ColumnName.ToString()
objDropdown.DataBind()
objDropdown.Items.Insert(0, "Select")
End Sub