I am trying to do two things. I want to connect to my local SQL Server Express Database and display records from a select statement.
I am trying to figure out if I need a FlexGrid or a DataGrid. All I want to do is display data, I don't really need any interactivity with the data, just displayed to the person who runs the VB Script. Also, am I correc to be using a Module for this task?
Second, for a local connection is this right?
The reason I ask, is when I run the module with this code included nothing happens except a small window that says "Form1" at the top. I would like the grid to show up like I am used to in Access. Sorry to ask so many questions but I am sort of lost here. I would appreciate any guidance.
Thanks.
I am trying to figure out if I need a FlexGrid or a DataGrid. All I want to do is display data, I don't really need any interactivity with the data, just displayed to the person who runs the VB Script. Also, am I correc to be using a Module for this task?
Second, for a local connection is this right?
Code:
Option Explicit
Private Sub ProcessAmazon()
Dim conSQL As ADODB.Connection
Set conSQL = New ADODB.Connection
conSQL.ConnectionString = "Provider=SQLNCLI.1;Integrated Security=SSPI;" & _
"Persist Security Info=False;" & _
"AttachDBFileName=C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data\Test.mdf;Data Source=.\sqlexpress"
conSQL.Open
conSQL.Execute "SELECT * FROM Sales;"
Set rstSQL = Nothing
conSQL.Close
Set conSQL = Nothing
End Sub
The reason I ask, is when I run the module with this code included nothing happens except a small window that says "Form1" at the top. I would like the grid to show up like I am used to in Access. Sorry to ask so many questions but I am sort of lost here. I would appreciate any guidance.
Thanks.