DotNetNewsgroup.com  
web access to complete list of Microsoft.NET newsgroups
   home   |   control panel login   |   archive  |  
 
  carried group
academic
adonet
aspnet
aspnet.announcements
aspnet.buildingcontrols
aspnet.caching
aspnet.datagridcontrol
aspnet.mobile
aspnet.security
aspnet.webcontrols
aspnet.webservices
assignment_manager
datatools
dotnet.distributed_apps
dotnet.general
dotnet.myservices
dotnet.nternationalization
dotnet.scripting
dotnet.security
dotnet.vjsharp
dotnet.vsa
dotnet.xml
dotnetfaqs
framework
framework.clr
framework.compactframework
framework.component_services
framework.controls
framework.databinding
framework.drawing
framework.enhancements
framework.interop
framework.odbcnet
framework.performance
framework.remoting
framework.sdk
framework.setup
framework.webservices
framework.windowsforms
framework.wmi
frwk.windowsforms.designtime
lang.csharp
lang.jscript
lang.vb
lang.vb.controls
lang.vb.data
lang.vb.upgrade
lang.vc
lang.vc.libraries
  
 
start date: Tue, 17 Jul 2007 13:08:02 -0700,    posted on: microsoft.public.dotnet.framework.adonet        back       

Thread Index
  1    Gordon


Help with this Argument 'Prompt' cannot be converted to type 'Stri   
Hi;

I am creating a windows app using ado.net 2.0 in the app I am connecting to 
a database by creating and then using a data provider factory.

When I call sqlConn.Open() I get the follwoing message "Argument 'Prompt - 
cannot be converted to type String".

What am I missing in my code ?

 
My code follows:

Here are the entries in my app.config file


<configuration>
    <appSettings>
		<add key="provider" value="System.Data.SqlClient" />
	</appSettings>
	<connectionStrings>
		<add name ="cnStr" connectionString =
		"Data Source=aServer;integrated Security=True;initial Catalog=GoodTable" />
	</connectionStrings>
</configuration>

Here is how I call this in my app. :

Try
            Dim sAttr As String = ConfigurationManager.AppSettings("provider")
            '    Dim dp As DataProvider = 
CType(Enum].Parse(GetType(DataProvider),sAttr), DataProvider)
            Dim cnStr As String = 
ConfigurationManager.ConnectionStrings("cnStr").ConnectionString
            ' Create the provider factory
            Dim df As DbProviderFactory = 
DbProviderFactories.GetFactory(sAttr)
            'Connection here
            Dim sqlConn As DbConnection = df.CreateConnection()
            sqlConn.ConnectionString = cnStr

        Catch ex As Exception
            MsgBox(ex)
        End Try

        Try
            sqlConn.Open()
        Catch ex1 As Exception
            MsgBox(ex1)
        End Try


Thanks for any suggestions !

-- 
Gordon
Date:Tue, 17 Jul 2007 13:08:02 -0700   Author:  

Google
 
Web dotnetnewsgroup.com


COPYRIGHT ?2005, EUROFRONT WORLDWIDE LTD., ALL RIGHT RESERVE  |   Contact us