I have a some .NET code that I need to translate into VB. Does anyone know
how
to do this? If so, thanks in advance!
Here is the code. I only need the translation code between START
TRANSLATION HERE and
END TRANSLATION HERE translated.
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button2.Click
Dim requestMsgSet As QBFC4Lib.IMsgSetRequest
Dim sessionmgr As QBSessionManager
Dim check As New RegistryReadEntry
sessionmgr = New QBSessionManager
sessionmgr.OpenConnection("", "Test Stuff")
qbookspath = check.GetRegValue(Microsoft.Win32.RegistryHive.Loc alMachine,
"SOFTWARE\LBS\", "quickbookspath")
qbooksfile = check.GetRegValue(Microsoft.Win32.RegistryHive.Loc alMachine,
"SOFTWARE\LBS\", "quickbooksfilename")
'sessionmgr.BeginSession(qbookspath & "\" & qbooksfile,
ENOpenMode.omDontCare)
sessionmgr.BeginSession("C:\Program Files\Intuit\QuickBooks Basic" & "\" &
"sample_product-based business.qbw", ENOpenMode.omDontCare)
Try
requestMsgSet = sessionmgr.CreateMsgSetRequest("US", "2", "0")
requestMsgSet.Attributes.OnError = QBFC4Lib.ENRqOnError.roeStop
Dim invoiceAdd As QBFC4Lib.IinvoiceAdd
invoiceAdd = requestMsgSet.AppendinvoiceAddRq
'START TRANSLATION HERE -
Dim sqlquery As String
Dim ds As DataSet
Dim item, desc, listid, weight, count, lastid As String
Dim records, i As Integer
sqlquery = "SELECT DISTINCTROW category.item, category.desc, Customers.acct,
Customers.CustomerName, Customers.listid, transactions.acct,
transactions.item, Sum(transactions.weight) AS [Sum Of weight], Count(*) AS
[Count Of category]"
sqlquery = sqlquery & " FROM Customers INNER JOIN (category INNER JOIN
transactions ON category.item = transactions.item) ON Customers.acct =
transactions.acct"
sqlquery = sqlquery & " GROUP BY category.item, category.desc,
Customers.acct, Customers.CustomerName, Customers.listid, transactions.acct,
transactions.item;"
ds = openDataSet(sqlquery)
records = ds.Tables(0).Rows.Count
If records < 0 Then
MsgBox("No records to Invioce", MsgBoxStyle.OKOnly, "invoice Error")
lastid = ""
Else
count = 0
For i = 0 To records - 1
item = ds.Tables(0).Rows(i)("item")
desc = ds.Tables(0).Rows(i)("desc")
listid = ds.Tables(0).Rows(i)("listid")
count = ds.Tables(0).Rows(i)("count of category")
weight = ds.Tables(0).Rows(i)("sum of weight")
Dim orinvoiceLineAdd As IinvoiceLineAdd
invoiceAdd.CustomerRef.ListID.SetValue(listid)
invoiceAdd.IsToBePrinted.SetValue(True)
invoiceAdd.TxnDate.SetValue(CDate(Now).ToShortDate String)
orinvoiceLineAdd = invoiceAdd.ORinvoiceLineAddList.Append.invoiceLine Add
orinvoiceLineAdd.ItemRef.FullName.SetValue(item)
orinvoiceLineAdd.Desc.SetValue(desc & " Number of Bins " & count)
orinvoiceLineAdd.Quantity.SetValue(weight)
If records - 1 <> i Then
lastid = ds.Tables(0).Rows(i + 1)("listid")
End If
If lastid <> listid Or i = records - 1 Then
'END TRANSLATION HERE
sessionmgr.DoRequests(requestMsgSet)
requestMsgSet = Nothing
requestMsgSet = sessionmgr.CreateMsgSetRequest("US", "2", "0")
requestMsgSet.Attributes.OnError = QBFC4Lib.ENRqOnError.roeStop
invoiceAdd = requestMsgSet.AppendinvoiceAddRq
End If
Next
End If
Yes People I figured it out. It may not be the best way ot do it but it
works. Please to whomever is out there put some usable samples out there
like the basics of adding an invoice etc...All the samples out there kind of
skate around teh 700lb gorilla in the room which is to CREATE invoiceS
Catch ex As Exception
MsgBox(ex.Source & ":" & ex.Message)
Finally
End Try
MsgBox("invoice Added")
sessionmgr.EndSession()
sessionmgr.CloseConnection()
sessionmgr = Nothing
End Sub 2 2810
JP,
You cannot, VBA cannot use ADO.NET what is the part you showed almost
completely.
(There is even a part probably in a dataacceslayer .... ds =
openDataSet(sqlquery))
You will have to use
ADODB what is completely different (other search item MDAC). http://msdn.microsoft.com/SQL/2000/l...c/default.aspx http://msdn.microsoft.com/data/mdac/...o/default.aspx
I hope this helps,
Cor
"JP Ogden" <jp*****@earthlink.net> schreef in bericht
news:Oo**************@TK2MSFTNGP11.phx.gbl... I have a some .NET code that I need to translate into VB. Does anyone know how to do this? If so, thanks in advance!
Here is the code. I only need the translation code between START TRANSLATION HERE and END TRANSLATION HERE translated.
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click Dim requestMsgSet As QBFC4Lib.IMsgSetRequest Dim sessionmgr As QBSessionManager Dim check As New RegistryReadEntry sessionmgr = New QBSessionManager sessionmgr.OpenConnection("", "Test Stuff") qbookspath = check.GetRegValue(Microsoft.Win32.RegistryHive.Loc alMachine, "SOFTWARE\LBS\", "quickbookspath") qbooksfile = check.GetRegValue(Microsoft.Win32.RegistryHive.Loc alMachine, "SOFTWARE\LBS\", "quickbooksfilename") 'sessionmgr.BeginSession(qbookspath & "\" & qbooksfile, ENOpenMode.omDontCare) sessionmgr.BeginSession("C:\Program Files\Intuit\QuickBooks Basic" & "\" & "sample_product-based business.qbw", ENOpenMode.omDontCare)
Try requestMsgSet = sessionmgr.CreateMsgSetRequest("US", "2", "0") requestMsgSet.Attributes.OnError = QBFC4Lib.ENRqOnError.roeStop
Dim invoiceAdd As QBFC4Lib.IinvoiceAdd invoiceAdd = requestMsgSet.AppendinvoiceAddRq
'START TRANSLATION HERE - Dim sqlquery As String Dim ds As DataSet Dim item, desc, listid, weight, count, lastid As String Dim records, i As Integer
sqlquery = "SELECT DISTINCTROW category.item, category.desc, Customers.acct, Customers.CustomerName, Customers.listid, transactions.acct, transactions.item, Sum(transactions.weight) AS [Sum Of weight], Count(*) AS [Count Of category]" sqlquery = sqlquery & " FROM Customers INNER JOIN (category INNER JOIN transactions ON category.item = transactions.item) ON Customers.acct = transactions.acct" sqlquery = sqlquery & " GROUP BY category.item, category.desc, Customers.acct, Customers.CustomerName, Customers.listid, transactions.acct, transactions.item;" ds = openDataSet(sqlquery) records = ds.Tables(0).Rows.Count If records < 0 Then MsgBox("No records to Invioce", MsgBoxStyle.OKOnly, "invoice Error") lastid = "" Else count = 0 For i = 0 To records - 1 item = ds.Tables(0).Rows(i)("item") desc = ds.Tables(0).Rows(i)("desc") listid = ds.Tables(0).Rows(i)("listid") count = ds.Tables(0).Rows(i)("count of category") weight = ds.Tables(0).Rows(i)("sum of weight")
Dim orinvoiceLineAdd As IinvoiceLineAdd invoiceAdd.CustomerRef.ListID.SetValue(listid) invoiceAdd.IsToBePrinted.SetValue(True) invoiceAdd.TxnDate.SetValue(CDate(Now).ToShortDate String)
orinvoiceLineAdd = invoiceAdd.ORinvoiceLineAddList.Append.invoiceLine Add
orinvoiceLineAdd.ItemRef.FullName.SetValue(item) orinvoiceLineAdd.Desc.SetValue(desc & " Number of Bins " & count) orinvoiceLineAdd.Quantity.SetValue(weight)
If records - 1 <> i Then lastid = ds.Tables(0).Rows(i + 1)("listid") End If If lastid <> listid Or i = records - 1 Then
'END TRANSLATION HERE
sessionmgr.DoRequests(requestMsgSet) requestMsgSet = Nothing requestMsgSet = sessionmgr.CreateMsgSetRequest("US", "2", "0") requestMsgSet.Attributes.OnError = QBFC4Lib.ENRqOnError.roeStop invoiceAdd = requestMsgSet.AppendinvoiceAddRq End If
Next
End If Yes People I figured it out. It may not be the best way ot do it but it works. Please to whomever is out there put some usable samples out there like the basics of adding an invoice etc...All the samples out there kind of skate around teh 700lb gorilla in the room which is to CREATE invoiceS
Catch ex As Exception MsgBox(ex.Source & ":" & ex.Message) Finally
End Try MsgBox("invoice Added") sessionmgr.EndSession() sessionmgr.CloseConnection() sessionmgr = Nothing End Sub
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Bengt Richter |
last post by:
Just thought None as the first argument would be both handy and mnemonic,
signifying no translation, but allowing easy expression of deleting characters,
e.g.,
s = s.translate(None,...
|
by: Xeon |
last post by:
Hi,
I'm trying to replace spaces with %20 with help of translate, but not
successfull. Here's a node in the xml file :
<title>This is some test title</title>
The xsl code I'm using :
...
|
by: Johnny Lee |
last post by:
Hi,
First, I want to know whether the python interpreter translate the
code directly into machine code, or translate it into C then into
machine code?
Second, if the codes are translated directly...
|
by: VBTricks.de.vu Webmaster |
last post by:
Hello,
in VB6 I used to translate my application by setting the tag-property of
all controls, menu-entries... to a number which has been linked to a
string (array). Then I went through all...
|
by: bobueland |
last post by:
The module string has a function called translate. I tried to find the
source code for that function. In:
C:\Python24\Lib
there is one file called
string.py
I open it and it says
|
by: peterbe |
last post by:
This has always worked fine for me.
Peter fine
Now if I do it with a unicode string:
Traceback (most recent call last):
File "<stdin>", line 1, in ?
File "/usr/lib/python2.4/string.py", line...
|
by: bvdet |
last post by:
I have done some more work on a simple class I wrote to calculate a global coordinate in 3D given a local coordinate:
## Basis3D.py Version 1.02 (module macrolib.Basis3D)
## Copyright (c) 2006...
|
by: amija0311 |
last post by:
Hi,
I am new using DB2 9.1 database by windows base.
I want to query the data that contain string then translate the string into integer using DB2.
The problems is If the data is null, i got the...
|
by: Kenneth McDonald |
last post by:
I have the need to occasionally translate a single word
programatically. Would anyone have a Python script that would let me
do this using Google (or another) translation service?
Thanks,
Ken
|
by: kovariadam |
last post by:
Hi,
Does anybody know why i get this error:
SQL0176N The second, third or fourth argument of the TRANSLATE scalar
function is incorrect. SQLSTATE=42815
with this query:
SELECT...
|
by: DJRhino |
last post by:
Was curious if anyone else was having this same issue or not....
I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 4 Oct 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM)
The start time is equivalent to 19:00 (7PM) in Central...
|
by: tracyyun |
last post by:
Hello everyone,
I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
|
by: giovanniandrean |
last post by:
The energy model is structured as follows and uses excel sheets to give input data:
1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
|
by: NeoPa |
last post by:
Hello everyone.
I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report).
I know it can be done by selecting :...
|
by: NeoPa |
last post by:
Introduction
For this article I'll be using a very simple database which has Form (clsForm) & Report (clsReport) classes that simply handle making the calling Form invisible until the Form, or all...
|
by: NeoPa |
last post by:
Introduction
For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...
|
by: isladogs |
last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, Mike...
|
by: GKJR |
last post by:
Does anyone have a recommendation to build a standalone application to replace an Access database? I have my bookkeeping software I developed in Access that I would like to make available to other...
| |