Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 help to convert VB to SQL Server

Author  Topic 

DMarmolejos
Yak Posting Veteran

65 Posts

Posted - 2008-08-06 : 12:35:08
Public Function GetBPProperties(ByRef oCompany As SAPbobsCOM.Company, ByRef oApplication As SAPbouiCOM.Application, ByRef CardCode As String) As String
GetBPProperties = ""
Try
Dim oRS As SAPbobsCOM.Recordset = oCompany.GetBusinessObject(BoObjectTypes.BoRecordset)

For i As Integer = 1 To 64
oRS.DoQuery("SELECT * FROM [dbo].[OCRD] T0 WHERE T0.CardCode='" & CardCode & "' AND T0.QryGroup" & i.ToString & " = 'Y'")
If oRS.RecordCount > 0 Then
GetBPProperties += ", " & i
End If
Next
Catch ex As Exception
oApplication.MessageBox(ex.Message)
End Try
End Function




Any help is appreciated, thank you

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2008-08-06 : 12:36:45
SQL Server is not a programming language, so you can't convert from VB to it. But do you just want a stored procedure or function that your application can call?

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

DMarmolejos
Yak Posting Veteran

65 Posts

Posted - 2008-08-06 : 12:38:50
yes please, a sql procedure or function would help a lot
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2008-08-06 : 13:45:56
Are you using SQL Server 2005?
If so, have a look at the UNPIVOT command.



E 12°55'05.25"
N 56°04'39.16"
Go to Top of Page
   

- Advertisement -