axalex
03-24-2004, 02:03 AM
I use the following "connection" procedure in VB gladly.
Option Explicit
Dim con As ADODB.Connection
Private Sub Form_Load()
Set con = New ADODB.Connection
con.Properties("Prompt").Value = adPromptAlways
con.Open
End Sub
Advantage I can select arbitrary ODBC - source.
Can I make similar in NET?
MKoslof
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
axalex
03-24-2004, 09:51 AM
I have not found ConnectionProperties in ADO.NET!
Is it in SqlConnection or OleDBConnection or ...?
Thanks
MKoslof
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:
Imports DTS
Sub Main()
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"
'etc
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.