03-24-2004, 02:03 AM
I use the following "connection" procedure in VB gladly.
Dim con As ADODB.Connection
Private Sub Form_Load()
Set con = New ADODB.Connection
con.Properties("Prompt").Value = adPromptAlways
Advantage I can select arbitrary ODBC - source.
Can I make similar in NET?
03-24-2004, 07:50 AM
Um..I think you can use the same method, did you try it? What is your complete SQL Server logon code..is it declared correctly.
You might need to use instead:
Connection.ConnectionProperties("Prompt").value = adPromptAlways
03-24-2004, 09:51 AM
I have not found ConnectionProperties in ADO.NET!
Is it in SqlConnection or OleDBConnection or ...?
03-24-2004, 12:51 PM
oh, OK. As an example, you can get to the .ConnectionProperties from the DT2 library (if are you using SQL Server) like so:
Dim oPackage As DTS.Package2Class
oPackage = New DTS.Package2Class()
Dim oConnection As DTS.Connection2
oConnection = oPackage.Connections.[New]("SQLOLEDB")
oConnection.ConnectionProperties.Item("Integrated Security").Value ="this"
oConnection.ConnectionProperties.Item("Persist Security Info").Value = "this"
oConnection.ConnectionProperties.Item("Initial Catalog").Value = "this"
I know there is a "Data Source" .item. I have never prompted for a source, so I am not sure exactly what parameter you need in .Net. If you research your database engine and the properties in .Net. I am sure you can find exactly what you need.