SV650.org - SV650 & Gladius 650 Forum



Idle Banter For non SV and non bike related chat (and the odd bit of humour - but if any post isn't suitable it'll get deleted real quick).
There's also a "U" rating so please respect this. Newbies can also say "hello" here too.

Reply
 
Thread Tools
Old 16-03-06, 04:54 PM   #1
mysteryjimbo
Guest
 
Posts: n/a
Default SQL server and VB

Hi,

Who can give me the VB code to connect to a SQL DB and get the results of two SELECT COUNT queries.

It'll save me looking it up! The syntax i used in vbscript isnt playing.

I need it so i can publish the results to a running Performance Counter which is logged in 3rd software. Since this package doesnt support vbscript i've had to go this way.....
  Reply With Quote
Old 16-03-06, 05:00 PM   #2
thor
Guest
 
Posts: n/a
Default

VB for Very Bad
  Reply With Quote
Old 16-03-06, 05:21 PM   #3
mysteryjimbo
Guest
 
Posts: n/a
Default

Helpful, buts its only meant as a short term solution until its integrated into the bespoke software.
  Reply With Quote
Old 16-03-06, 05:33 PM   #4
TSM
The Sick Man
Mega Poster
 
TSM's Avatar
 
Join Date: Nov 2004
Location: Peckham.SE.LDN
Posts: 4,768
Default

I only realy know ASP VB not VB per say.

Have a look here.

http://www.freevbcode.com/ShowCode.Asp?ID=1257
http://vijis.sys.virginia.edu/Developers/DBconnect.htm
__________________
OTR: KTM 690 Duke R 2015 Full Akro
SIDELINE: Kwak ZX636 A1P 2002, Red, R&G's, Yoshi, Double Bubble Screen
GONE: Kwak ZX-7R P1, Full Akro, Undertray, Screen
GONE: SV650S K2 Very Bruised & Without Fairing, Motovation Frame Sliders, R&G Ally Sprocket Toe Protector, HEL 2 Line Setup, GSXR K1 600 RWU Forks, Barnett Clutch & Springs, Penske 8981 Shock, Gilles Ti Rearsets, Steel Barends, Scottoiler, AFAM Chain & Sprockets, Twin FIAMM Horns, Skidmarx Bellypan, Full Micron Zeta Steel System, Cut down undertay.

Forum Problems & Information / Site Suggestions
TSM is offline   Reply With Quote
Old 16-03-06, 05:55 PM   #5
timwilky
Member
Mega Poster
 
timwilky's Avatar
 
Join Date: Mar 2004
Location: Not in Yorkshire. (Thank God)
Posts: 4,116
Default

vb? sorry i use java and C#.net Don't be so lazy ...look it up
__________________
Not Grumpy, opinionated.
timwilky is offline   Reply With Quote
Old 17-03-06, 12:41 AM   #6
Gnan
Guest
 
Posts: n/a
Default

this should get it into a recordset object in vbscript

set objConnection = createObject("ADODB.Connection")
set objRecordset = createObject("ADODB.Recordset")
objConnection.Open "DSN=<your preconfigured DSN>;"
objRecordset.CursorLocation = 4
objRecordset.Open "SELECT COUNT(colname) FROM YOURTABLE" ,objConnection,3,3
objRecordset.Close
objConnection.Close
  Reply With Quote
Old 17-03-06, 09:17 AM   #7
TSM
The Sick Man
Mega Poster
 
TSM's Avatar
 
Join Date: Nov 2004
Location: Peckham.SE.LDN
Posts: 4,768
Default

VBScript diffrent from proper VB
__________________
OTR: KTM 690 Duke R 2015 Full Akro
SIDELINE: Kwak ZX636 A1P 2002, Red, R&G's, Yoshi, Double Bubble Screen
GONE: Kwak ZX-7R P1, Full Akro, Undertray, Screen
GONE: SV650S K2 Very Bruised & Without Fairing, Motovation Frame Sliders, R&G Ally Sprocket Toe Protector, HEL 2 Line Setup, GSXR K1 600 RWU Forks, Barnett Clutch & Springs, Penske 8981 Shock, Gilles Ti Rearsets, Steel Barends, Scottoiler, AFAM Chain & Sprockets, Twin FIAMM Horns, Skidmarx Bellypan, Full Micron Zeta Steel System, Cut down undertay.

Forum Problems & Information / Site Suggestions
TSM is offline   Reply With Quote
Old 17-03-06, 02:37 PM   #8
huge
Guest
 
Posts: n/a
Default

Link to the queries using a data control and view the query through a datagrid

No code needed to do this

(you might need to add these controls)

if you want to take it further recordsets use a load of methods like update, copy, edit, requery etc.

hope this has helped
  Reply With Quote
Old 17-03-06, 03:41 PM   #9
mysteryjimbo
Guest
 
Posts: n/a
Default

Sorted it! Its been so long since i did any VB "proper" that i'd forgot a few things.....

I now have two working performance counters monitoring the number of records in two tables. :thumsbup:

Hopefully this monitoring software will log and alert to it automatically like its supposed to!
  Reply With Quote
Old 17-03-06, 10:35 PM   #10
Gnan
Guest
 
Posts: n/a
Default

tsm, i saw the word vbscript in the post and must have ignored the rest the mrs says that to me sometimes - selective hearing?
  Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
secure file server DoubleD Idle Banter 5 27-09-06 12:46 PM
SQL server Gnan Idle Banter 2 31-05-06 05:40 AM


All times are GMT. The time now is 12:56 AM.


Powered by vBulletin® - Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.