?
Solved

Access stored procedure to sql server equivalent

Posted on 2006-06-27
2
Medium Priority
?
166 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
2 Comments
 
LVL 52

Accepted Solution

by:
Carl Tawn earned 2000 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

[Webinar] Lessons on Recovering from Petya

Skyport is working hard to help customers recover from recent attacks, like the Petya worm. This work has brought to light some important lessons. New malware attacks like this can take down your entire environment. Learn from others mistakes on how to prevent Petya like worms.

Question has a verified solution.

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

Microsoft Reports are based on a report definition, which is an XML file that describes data and layout for the report, with a different extension. You can create a client-side report definition language (*.rdlc) file with Visual Studio, and build g…
Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Suggested Courses

764 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