Solved

Access stored procedure to sql server equivalent

Posted on 2006-06-27
2
161 Views
Last Modified: 2010-04-23
My stored procedure looks like this in vb.net 2003 ... what would the equiv look like in if I were using sql server...
Dim spName As String
        Dim spSearch As String
        Dim Row As Integer

        odaRate.SelectCommand = New OleDb.OleDbCommand
        With odaRate.SelectCommand
            .CommandType = CommandType.StoredProcedure
            .Parameters.Add("spZip", OleDbType.VarChar, 10).Value = mskOZip.ClipText
            .CommandText = "spZipSearch"
            .Connection = cnnRate
        End With
        dsRate.Clear()
        Try
            odaRate.Fill(dsRate, "Zip")
        Catch ex As Exception
            MsgBox(ex.Message)
        End Try
        Me.dtgTest.DataSource = dsRate.Tables("Zip")
0
Comment
Question by:michaelbuller
  • 2
2 Comments
 
LVL 52

Accepted Solution

by:
Carl Tawn earned 500 total points
ID: 16995800
It would look exactly the same, except you would change "OleDb.OleDbCommand" and "OleDbType.VarChar" to "SqlClient.SqlCommand" and "SqlDbType.VarChar" respectively.
0
 
LVL 52

Expert Comment

by:Carl Tawn
ID: 16995816
Alternatively you could connect to SQL Server using the OleDb data objects rather than the native Sql objects; in which case you wouldn't have to change anything.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Since .Net 2.0, Visual Basic has made it easy to create a splash screen and set it via the "Splash Screen" drop down in the Project Properties.  A splash screen set in this manner is automatically created, displayed and closed by the framework itsel…
The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…
Both in life and business – not all partnerships are created equal. As the demand for cloud services increases, so do the number of self-proclaimed cloud partners. Asking the right questions up front in the partnership, will enable both parties …

920 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now