请高手帮忙翻译下

cwb210 2008-11-25 01:49:42
mCurDate = dt
lblTitle.Caption = Format(dt, "yyyy-MM-dd") & "生日提醒"
Dim strsql As String
Dim rs As ADODB.Recordset
Dim strThisAlertText As String
Dim strNextAlertText As String
Dim i As Long
Dim strDate As String
Dim strThisDay As String
Dim strNextDay As String

strThisDay = Month(dt) & "-" & Day(dt)
strNextDay = Month(DateAdd("d", 1, dt)) & "-" & Day(DateAdd("d", 1, dt))
strsql = "SELECT * FROM CUSTOMER " & _
"WHERE (NOT [Birthday] IS NULL) AND ((CStr(Month([Birthday]))+""-""+CStr(Day([Birthday]))) = '" & strThisDay & "'" & _
" OR (CStr(Month([Birthday]))+""-""+CStr(Day([Birthday]))) = '" & strNextDay & "') " & _
"ORDER BY [Birthday]"
Set rs = m_oConn.Execute(strsql)
If rs.RecordCount = 0 Then Exit Function
For i = 1 To rs.RecordCount
strDate = Month(rs("Birthday")) & "-" & Day(rs("Birthday"))
Select Case strDate
Case strThisDay
strThisAlertText = strThisAlertText & vbCrLf & vbTab & Field2Str(rs("Name")) & "," & Field2Str(rs("Tel"))
Case strNextDay
strNextAlertText = strNextAlertText & vbCrLf & vbTab & Field2Str(rs("Name")) & "," & Field2Str(rs("Tel"))
End Select
rs.MoveNext
Next
If Len(strThisAlertText) > 0 Then strThisAlertText = Format(dt, "yyyy-MM-dd") & "生日:" & strThisAlertText
If Len(strNextAlertText) > 0 Then strNextAlertText = Format(DateAdd("d", 1, dt), "yyyy-MM-dd") & "生日:" & strNextAlertText
GetBirthdayInfo = strThisAlertText
If Len(strThisAlertText) > 0 Then
GetBirthdayInfo = GetBirthdayInfo & vbCrLf & strNextAlertText
Else
GetBirthdayInfo = strNextAlertText
End If
End Function


请帮忙翻译下称c#的,看得累啊,谢谢了
...全文
72 4 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
cwb210 2008-11-25
  • 打赏
  • 举报
回复
谢谢3楼的 辛苦了 呵呵
nj_link 2008-11-25
  • 打赏
  • 举报
回复
mCurDate = dt //这应该是个date类型?
lblTitle.Caption = dt.Format("yyyy-MM-dd") + "生日提醒" ;
String strsql;
ADODB.Recordset rs ;
String strThisAlertText;
String strNextAlertText;
int i;
String strDate;
String strThisDay;
String strNextDay;
strThisDay = dt.getmonth() + "-" + dt.getday();
strNextDay = DateAdd("d", 1, dt).getMonth() + "-" + DateAdd("d", 1, dt).getDay; //DateAdd()是什么东东??
strsql = "SELECT * FROM CUSTOMER " + _
"WHERE (NOT [Birthday] IS NULL) AND ((CStr(Month([Birthday]))+""-""+CStr(Day([Birthday]))) = '" + strThisDay + "'" + _
" OR (CStr(Month([Birthday]))+""-""+CStr(Day([Birthday]))) = '" + strNextDay + "') " + _
"ORDER BY [Birthday]" ;
rs = m_oConn.Execute(strsql);
if(rs.RecordCount = 0)
return;
for (i = 1 ; i <= rs.RecordCount; i++ )
{
strDate = Month(rs("Birthday")) + "-" + Day(rs("Birthday"))
swith(strDate)
Case strThisDay
strThisAlertText = strThisAlertText + vbCrLf + vbTab + Field2Str(rs("Name")) + "," + Field2Str(rs("Tel")); break;
Case strNextDay
strNextAlertText = strNextAlertText + vbCrLf + vbTab + Field2Str(rs("Name")) + "," + Field2Str(rs("Tel"));
rs.MoveNext;
}
if (strThisAlertText.length > 0 )
strThisAlertText = dt.Format("yyyy-MM-dd") + "生日:" + strThisAlertText;
else if (strNextAlertText.length > 0 )
strNextAlertText = DateAdd("d", 1, dt).Format("yyyy-MM-dd") + "生日:" + strNextAlertText;//dateAdd??
GetBirthdayInfo = strThisAlertText;
else if (strThisAlertText.length > 0 )
GetBirthdayInfo = GetBirthdayInfo + vbCrLf + strNextAlertText ;
else
GetBirthdayInfo = strNextAlertText;

Wayne 2008-11-25
  • 打赏
  • 举报
回复
up
net5i 2008-11-25
  • 打赏
  • 举报
回复
vb6的代码,搂主可以自己下载个工具自己翻译,纯手工的

111,098

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • AIGC Browser
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧