Vscript to Vb.net

vvic

New member
Joined
Feb 22, 2017
Messages
1
Programming Experience
Beginner
Hi, First of all let me start saying I'm on my almost 70s and I am not by any means a programmer, not sure even if id call myself a beginner. So be patient please!

Some years ago, I made an script in vbscript which worked fine for the time but i need to migrate it to vb or vb.net and make it work now.

I've been reading a lot about how to possibily making it, to the point I'm a bit frustrated with the process :( I know I shouldn't be using ADODB at this point, but it was really hard to understand ado.net and sqldata to me :(

I managed (I think) to connect to the db and make the query but I get the following message when trying to run it:

The 'Field' type to 'String' is invalid on this little code (another language, not sure if it's the exact translation)

inipos = InStr(cObCli, "[/Fac:")
endpos = InStr(cObCli, "/]")

I guess it could be caused by cObCli = objCli.Fields.Item("Tclients5") being empty, but I'm not sure how to even test it to be honest.

Also, on the query :

Dim cSQLQuery = "SELECT SUM(TVFACV2) FROM TVFACV WHERE TVFACV14='" & cCodCli & "' AND TVFACV4='N' AND TVFACV1<Date()"

I'm getting an error saying '&' is not defined for "SELECT SUM(TVFACV2)"

So, can anyone take a look at the attached code on the txt or run it on Vstudio and help me please?

I'd be forever grateful.

Thanks in advance.

I'll leave the code here too, just in case something goes wrong with the txt: Module ModCob Sub Main() Const adOpenStatic = 3 C - Pastebin.com
 

Attachments

  • cod.txt
    2.7 KB · Views: 19
Top Bottom