borderAndreaVB free resources for Visual Basic developersborder

borderAndreaVB Visual Basic and VB.NET source code resources - Copyright © 1999-2007 Andrea Tincaniborder

AndreaVB | Forum | News | Downloads | Register | Help | Member List | Statistics | Search | PM | Profile

Print This Topic
Previous Topic (How to know event click on header of MSFlex was happened?)Next Topic (how to refresh an access DB) New Topic New Poll Post Reply
AndreaVB Forum : Database : Vb,MySql- insert/import function
Poster Message
jonybd
Level: Master

Registered: 18-01-2005
Posts: 115

icon Vb,MySql- insert/import function

Hi,
I have 10 to 20 stored procedure functions for mysql.

I want to use vb program to import/insert those to mysql ! for example the following function how can i insert into mysql.

quote:
//For Reseller
Create function f_Rbill (v_Agent varchar(3), v_Comp varchar(100) ) returns varchar(100)
BEGIN

declare a1 bigint;
declare a2 bigint;

declare v_Result varchar(100);

select sum(amount) into a1 from reload where agentid=v_Agent and compid=v_Comp;
select sum(amount) into a2 from payment where agentid=v_Agent and compid=v_Comp;

set a1 := IFNULL(a1, 0);
set a2 := IFNULL(a2, 0);

set v_Result := concat(a1, ",", a2);

return v_Result;

END;


____________________________
Telecommunication programmer.
Sip, Isdn - technology.
28-07-2006 at 08:12 AM
View Profile Send Email to User Show All Posts Visit Homepage | Quote Reply
jonybd
Level: Master

Registered: 18-01-2005
Posts: 115
icon Re: Vb,MySql- insert/import function

this is what working..

Private Sub Command1_Click()

    Dim sqlDB As ADODB.Connection
    'connection
    Set sqlDB = New ADODB.Connection
    sqlDB.Mode = adModeReadWrite
    sqlDB.Open "Driver={MySQL ODBC 3.51 Driver};" & _
                   "SERVER=" & "andreavb.ipowermysql.com" & ";" & _
                   "DATABASE=" & "test" & ";" & _
                   "UID=root;" & _
                   "PASSWORD=root;" & _
                   "OPTION=3"
    sqlDB.CursorLocation = adUseClient
    sqlDB.Execute "CREATE function f_one() returns varchar(20) " _
            & "BEGIN insert into mcl(COUNTRY,CODE,PEAK,OFFPEAK,WEEKEND) values ('usa','1','21','22','23'); return v_Hi; END"

End Sub


____________________________
Telecommunication programmer.
Sip, Isdn - technology.

28-07-2006 at 12:25 PM
View Profile Send Email to User Show All Posts Visit Homepage | Quote Reply
AndreaVB Forum : Database : Vb,MySql- insert/import function
Previous Topic (How to know event click on header of MSFlex was happened?)Next Topic (how to refresh an access DB) New Topic New Poll Post Reply
Surf To:


Not Logged In? Username: Password: Lost your password?
Partners: Download Actual Software | Free Software Download
borderAndreaVB free resources for Visual Basic developersborder

borderAndreaVB Visual Basic and VB.NET source code resources - Copyright © 1999-2007 Andrea Tincaniborder