Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<pre><code>PrivateFunction GetDataFromDb(ByVal lcSQL AsString, ByVal loCommandType As CommandType, _ ByVal lcTableName AsString, ByValParamArray loParameters() As SqlParameter) As DataSet Dim loResult As DataSet Dim loConnection As SqlConnection Dim loCommand As SqlCommand Dim loAdapter As SqlDataAdapter Dim i As Int32 Dim loParameter As SqlParameter Try 'Create and open connection to the Northwind database loConnection = New SqlConnection("Persist Security Info=False;Integrated Security=SSPI;database=northwind;server=(local);Connect Timeout=30") loConnection.Open() 'Prepare command and to select data from the database loCommand = New SqlCommand(lcSQL, loConnection) loCommand.CommandType = loCommandType IfNot loParameters IsNothingThen ForEach loParameter In loParameters loCommand.Parameters.Add(loParameter) Next EndIf loAdapter = New SqlDataAdapter(loCommand) loResult = New DataSet loAdapter.Fill(loResult, lcTableName) 'Return list of the customers as a DataSet Return loResult Catch ex As Exception Throw ex Finally 'Clean resources IfNot loAdapter IsNothingThen loAdapter.Dispose() loAdapter = Nothing EndIf IfNot loCommand IsNothingThen loCommand.Dispose() loCommand = Nothing EndIf IfNot loConnection IsNothingThen If loConnection.State = ConnectionState.Open Then loConnection.Close() EndIf loConnection.Dispose() loConnection = Nothing EndIf EndTry EndFunction </code></pre> <p>Found at: <a href="http://support.microsoft.com/kb/555266" rel="nofollow">http://support.microsoft.com/kb/555266</a></p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload