Solved

Access stored procedure to sql server equivalent

Posted on 2006-06-27
2
160 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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

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…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…

708 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

21 Experts available now in Live!

Get 1:1 Help Now