 |
jonybd Level: Master
 Registered: 18-01-2005 Posts: 115
|
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 |
|
|
jonybd Level: Master
 Registered: 18-01-2005 Posts: 115
|
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 |
|
|
|
|
 |
 |