我需要使用在我的存儲過程切換案例分配的變量,但我總是得到意想不到的結果。請幫助..任何答覆將是一個很大的help.thanks。使用開關案例分配變量
private void CheckMessage()
{
string chk = null;
ShortMessage l = new ShortMessage();
string strCommand = "AT+CMGL=\"ALL\"";
objShortMessageCollection = objclsSMS.ReadSMS(this.port, strCommand);
foreach (ShortMessage msg in objShortMessageCollection)
{
l.Message = msg.Message;
string[] splt = l.Message.Split('#');
for (int i = 0; i < splt.Length; i++)
{
string[] parts = splt[i].Split(':');
char prefix = Convert.ToChar(parts[0]);
string value = parts[1];
switch (prefix)
{
case 'T':
l.truck = value;
break;
case 'D':
l.driver = value;
break;
case 'R':
l.receiveby = value;
break;
case 'A':
l.arrivedate = value;
break;
case 'U':
l.unloaddate = value;
break;
case 'N':
l.deliverynote = value;
break;
case 'L':
l.deliverydate = value;
break;
case 'S':
l.deliverystatus = value;
break;
case 'M':
l.mac = value;
break;
case 'C':
l.msgcreatedate = value;
break;
}
}
chk = l.getINFO(l).Tables[0].Rows[0][0].ToString();
if (chk == "1")
{
this.AutomaticReply();
this.DeleteToSim();
}
else
{
this.DeleteToSim();
}
l = null;
}
}
#endregion
這裏是我的存儲過程..
ALTER PROCEDURE [dbo].[Message_Check]
@truck nvarchar(20),
@driver nvarchar(20),
@deliverynote int
AS
BEGIN
SELECT 1 FROM Truck trk, Driver drv, DeliveryNotes dnt
WHERE trk.Plate_Number = @truck
AND drv.DRIVER_ID = @driver
AND dnt.DNID = @deliverynote
AND dnt.Status = 'N'
END
什麼是 「意想不到的結果」 –