贝灵顿梗体味重:vb可以调用matlab吗,怎样调用?

来源:百度文库 编辑:中科新闻网 时间:2024/04/28 03:30:12

由于内容很多,
我上传了一个共享资料:你去我的共享资料那边查找一下,
关于VB调用SQL存储过程的语句。
希望对你有所帮助。

存储过程:SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS OFF
GO

/****** Object: Stored Procedure dbo.ZL_Day_Curve_proc Script Date: 2003-8-14 17:04:20 ******/
--exec ZL_Day_Curve_proc '2003-07-03 11:36:29','基站',1,1,1,1

ALTER PROCEDURE ZL_Day_Curve_proc(
@date datetime, --报表日期
@SUName varchar(50), --基站名称
@FirstAddr smallint, --SU地址第1字节
@SecondAddr smallint,--SU地址第2字节
@ThirdAddr smallint,--SU地址第3字节
@result smallint out --返回结果 0表示成功 1表示异常 其他表示异常类型(保留)
)
AS
/*
变量说明:
数值的时间(时刻)
数值量
*/
--时间的计算,查询不同的表
declare @chrDate varchar(50)

set @chrDate=cast(year(@date) as varchar) +'-'+cast(month(@date) as varchar)+'-'+cast(day(@date) as varchar)+' 0:0:0'
set @date=cast(@chrDate as datetime)
if year(@date)=year(getdate()) and month(@date)=month(getdate()) and day(@date)=day(getdate())
BEGIN
select cast(DataTime as datetime) as 'DataTime',cast(VariableData as float) as 'DataVal'
from CurrentAnalog where FirstAddress=@FirstAddr and SecondAddress=@SecondAddr and
ThirdAddress=@ThirdAddr and FourthAddress=237 and DataTime>@date and DataTime<dateadd(dd,1,@date)
order by DataTime
END

else
BEGIN
select cast(DataTime as datetime) as 'DataTime',cast(VariableData as float)as 'DataVal'
from HistoryAnalog where FirstAddress=@FirstAddr and SecondAddress=@SecondAddr and
ThirdAddress=@ThirdAddr and FourthAddress=237 and DataTime>@date and DataTime<dateadd(dd,1,@date)
order by DataTime
END
set @result=0
return 0

/*

Create Table #DCDeviceDayTmpTable
(DataTime datetime,
DataVal float
)

declare @charTmp varchar(30)
declare @intTotal int
declare @intInterval int
declare @intCircle int

declare @DateBegin datetime
declare @DateEnd datetime
declare @DateTmp datetime
declare @DataVal float

set @charTmp=cast(year(@date) as varchar) +'-'+cast(month(@date) as varchar)+'-'+cast(day(@date) as varchar)
set @DateBegin=cast(@charTmp as datetime)
set @DateEnd=dateadd(dd,1,@DateBegin)

set @intTotal=datediff(ss,@DateBegin,@DateEnd)
set @intCircle=200
set @intInterval=@intTotal/@intCircle

while @intCircle>=0
begin
set @DateTmp=dateadd(ss,@intInterval*(200-@intCircle),@DateBegin)
set @DataVal=RAND(@intCircle*@intInterval)*200
set @intTotal=cast(@DataVal as int)
set @DataVal=(@DataVal-@intTotal)*1000

set @intCircle=@intCircle-1
--插入基站名称
insert #DCDeviceDayTmpTable(DataTime,DataVal) values(@DateTmp,@DataVal)
end

--计算结束
select * from #DCDeviceDayTmpTable
*/

GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO

调用存储过程,
第一段:
Private Sub DealWithAcDeviceCurve()
On Error GoTo ERR
Dim i As Integer
Dim intNumber As Integer

Dim strEFTrueDes As String '¾ù¸¡³äΪtrueʱµÄÎÄ×ÖÃèËÙ
Dim strEFFalseDes As String '¾ù¸¡³äΪFalseʱµÄÎÄ×ÖÃèËÙ

Dim strReportTitle As String '±¨±í±êÌâ
Dim strScName As String '¼à¿ØÖÐÐÄÃû³Æ
Dim strDateNotice As String '±¨±íʱ¼äÃèËÙ
Dim strDateValue As String '±¨±íʱ¼äÖµ

Dim strStorePro As String '´æ´¢¹ý³ÌÃû³Æ
Dim strSelectSuName As String 'Ñ¡ÔñµÄ»ùÕ¾Ãû

Dim strAddressArray() As String '´æ·ÅÑ¡ÖеĵØÖ·Êý×é

'¼ì²éʱ¼ä
If txtDateCurve.text = "" Then
MsgBox "δѡÔñ±¨±íʱ¼ä£¡", vbExclamation, g_cnststrMsgTitle
GoTo ERR
End If
strDateValue = Format(Trim(DTPDateCurve.value), "yyyy-mm-dd") & " " & Format(Trim(DTPTimeCurve.value), "hh:nn:ss")

'ͳ¼Æ»ùÕ¾ÊýÁ¿
If txtSelectSuCurve.text = "" Or txtSelectSuCurve.Tag = "" Then
MsgBox "δѡÔñ»ùÕ¾£¡", vbExclamation, g_cnststrMsgTitle
GoTo ERR
End If

If CheckIpAddress(Trim(txtSelectSuCurve.Tag)) = False Then
MsgBox "»ùÕ¾Âß¼­µØÖ·´íÎó£¡", vbExclamation, g_cnststrMsgTitle
GoTo ERR
End If
AnalyzeString Trim(txtSelectSuCurve.Tag), ".", strAddressArray
If UBound(strAddressArray) <> 3 Then
MsgBox "»ùÕ¾Âß¼­µØÖ·´íÎó£¡", vbExclamation, g_cnststrMsgTitle
GoTo ERR
Else

For i = 0 To 3
If IsNumeric(Trim(strAddressArray(i))) = False Then
MsgBox "»ùÕ¾Âß¼­µØÖ·´íÎó£¡", vbExclamation, g_cnststrMsgTitle
GoTo ERR
End If
Next
End If

Me.MousePointer = vbHourglass

'±¨±íÍ·
If frmMain.TreeViewLog.Nodes.Count <= 0 Then
strScName = "" '¼à¿ØÖÐÐÄÃû³Æ
Else
strScName = frmMain.TreeViewLog.Nodes(1).text '¼à¿ØÖÐÐÄÃû³Æ
End If

If optHourCurve.value = True Then 'ÈÕ¸ºÔØÇúÏß
strReportTitle = "½»Á÷É豸ʱ¸ºÔØÇúÏß" '±¨±í±êÌâ
strDateNotice = "ͳ¼ÆСʱ" '±¨±íʱ¼äÃèËÙ
strStorePro = "JL_Hour_Curve_proc"
ElseIf optDay.value = True Then 'ÈÕ±¨±í
strReportTitle = "½»Á÷É豸ÈÕ¸ºÔØÇúÏß" '±¨±í±êÌâ
strDateNotice = "ͳ¼ÆÈÕÆÚ" '±¨±íʱ¼äÃèËÙ
strStorePro = "JL_Day_Curve_proc"
ElseIf optMonth.value = True Then 'Ô±¨±í
strReportTitle = "½»Á÷É豸Ô¸ºÔØÇúÏß" '±¨±í±êÌâ
strDateNotice = "ͳ¼ÆÔ·Ý" '±¨±íʱ¼äÃèËÙ
strStorePro = "JL_Month_Curve_proc"
ElseIf optYear.value = True Then
strReportTitle = "½»Á÷É豸Ä긺ÔØÇúÏß" '±¨±í±êÌâ
strDateNotice = "ͳ¼ÆÄê·Ý" '±¨±íʱ¼äÃèËÙ
strStorePro = "JL_Year_Curve_proc"
End If

第二段: