Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
johnpapa
Starting Member
7 Posts |
Posted - 2012-12-17 : 03:44:29
|
Being new to SQL Server, I am trying to take some decisions as to how to proceed. For the time being I intend to use Access as a front end and vba for programing.I have looked into ODBC (DSN and DSN-less) and I am leaning towards using ADO with the SQL Native Client 11.0. Typical code for executing a simple SP is indicated below.Do you have a any general pointers based on your experience that might save time and effort? Thanks.Dim con As New ADODB.ConnectionDim rst As New ADODB.RecordsetDim cmd As New ADODB.Command'OLE DB (ADO) Native CLientcon.ConnectionString = "Provider=SQLNCLI11;" _ & "DataSource=MSSQLSERVER;" _ & "Server=(local);" _ & "Database=JP1;" _ & "Uid=sa;" _ & "Pwd=p5p6p7p8;" _ & "DataTypeCompatibility=80;" _ & "MARS Connection=True;"con.Opencon.CursorLocation = adUseClientcon.CommandTimeout = 0Set cmd = New ADODB.CommandWith cmd .ActiveConnection = con .CommandText = "JPSP4" .CommandType = adCmdStoredProc .Parameters.Refresh .Parameters("@lngNum").Value = 2End WithSet rst = cmd.ExecuteSet Me.Recordset = rstcon.CloseSet con = NothingSet cmd = NothingSet rst = Nothing |
|
|
|
|