Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

       Dim adoConnection As New Connection
       Dim adoRecordset As New Recordset
       Dim spSource As Object
       Dim strConn As String

       strConn = "driver={SQL Server};server=" & gstrServer & ";database=" & gstrDB

       adoConnection.Open(strConn)

       adoRecordset.Open("EXEC SP_Telesales_Prof_Search '" & txtProfID.Text & "', '" & txtFirstName.Text & "', '" & txtLastName.Text & "'", adoConnection, CursorTypeEnum.adOpenStatic)

        grdResult.DataSource = adoRecordset

 

I am trying to run a stored procedure, which will return all of the professionals located in a field based on all or part entries in three fields. I tested the stored procedure and it works fine. When I try to run the code it breaks when I try to set the data grid to the result of the record set. Not sure if this will be enough to diagnose. I tried using a previous post as an example but I have not had much luck with SQL objects so I am trying ADO instead.

 

Brian

"Beer is proof that God loves us and wants us to be happy."

-Benjamin Franklin

Posted (edited)

code that you provided works fine in VB6 (i pressume), but .Net

have different aproach for data storing,representing and so on .....

RecordSet DO NOT exist in .NET they are here JUST FOR compatibility!!!

Edited by sizer
Some people are wise and some are other-wise.
Posted

I am starting to figure it out now. I am now trying to figure out how to get the results from the stored procedure into the datagrid. Can I do it directly or do I need a liason of sorts?

Brian

"Beer is proof that God loves us and wants us to be happy."

-Benjamin Franklin

Posted

       Dim sqlAdapter As SqlClient.SqlDataAdapter
       Dim dsDataSet As DataSet
       Dim strConn As String
       Dim strSQL As String

       strConn = "data source=" & gstrServer & ";initial catalog=" & gstrDB & ";user id = sa"
       strSQL = "EXEC SP_Telesales_Prof_Search '" & txtProfID.Text & "', '" & txtFirstName.Text & "', '" & txtLastName.Text & "'"

       sqlAdapter = New SqlClient.SqlDataAdapter(strSQL, strConn)

       dsDataSet = New DataSet

       sqlAdapter.Fill(dsDataSet)

       grdResult.DataSource = dsDataSet

 

Thanks for the great link.

 

I dumped recordsets and am trying it with a dataset. How do I specify passthrough security instead of specifying a user name.

 

strConn = "data source=" & gstrServer & ";initial catalog=" & gstrDB & ";SPECIFY PASS THROUGH SECURITY HERE?"

 

I tried just removing it from the connection string but it just errors out.

 

Brian

"Beer is proof that God loves us and wants us to be happy."

-Benjamin Franklin

Posted

Found it...

Replace the user id = sa with

 

Integrated Security=SSPI

 

and it works...

 

Wow that is cool.

 

Brian

"Beer is proof that God loves us and wants us to be happy."

-Benjamin Franklin

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...