1. What is the difference between these two assignment operations (VB/VBA)?Set object2 = object1
object2 = object12. What is the difference between these two statements (VB/VBA)?If object1 Is object2 Then (...)
If object1 = object2 Then (...)3. Can function results be objects?4. What are some of the things that are wrong with this function (VB/VBA)? There is a bug in this code which will show up in certain cases. What is it?Public Function LastPaymentDate( Conn As ADODB.Connection, _
AccountNumber As String) As Date
Dim RS As ADODB.Recordset Set RS = Conn.Execute( _
"SELECT * " _
& "FROM AR " _
& "WHERE AccountNumber = '" & AccountNumber & "' " _
& "ORDER BY PostingDate DESC")
LastPaymentDate = IIf(RS.EOF, 0, RS.Fields("PostingDate").Value)
RS.Close
Set RS = Nothing
End Function5. How can I get the last day of a certain month in VB/VBA? Please complete the following function:Public Function LastDayOfMonth(Mn As Integer, Yr As Integer) As Date
End Function
object2 = object12. What is the difference between these two statements (VB/VBA)?If object1 Is object2 Then (...)
If object1 = object2 Then (...)3. Can function results be objects?4. What are some of the things that are wrong with this function (VB/VBA)? There is a bug in this code which will show up in certain cases. What is it?Public Function LastPaymentDate( Conn As ADODB.Connection, _
AccountNumber As String) As Date
Dim RS As ADODB.Recordset Set RS = Conn.Execute( _
"SELECT * " _
& "FROM AR " _
& "WHERE AccountNumber = '" & AccountNumber & "' " _
& "ORDER BY PostingDate DESC")
LastPaymentDate = IIf(RS.EOF, 0, RS.Fields("PostingDate").Value)
RS.Close
Set RS = Nothing
End Function5. How can I get the last day of a certain month in VB/VBA? Please complete the following function:Public Function LastDayOfMonth(Mn As Integer, Yr As Integer) As Date
End Function
解决方案 »
- vb6中 如何使用画板打开一张图片?需要导入什么吗?
- 如何从一个文件的指定位置读取指定长度的字节?
- 急求!!!怎么用modem拨号后播放一段音频文件给对放听
- 关于共享目录加密的贴子给分,不过目前还没解决
- 如何在网络中发送图片到richtext中显示?
- 请问如何限制文本框中输入的数字整数位数和小数位数?急~~~
- MSFlexGrid和RemoteData控件问题!
- 在线等待,请教锁住键盘中指定键的问题
- 如何 在VB 程序中嵌套Turbo c编译器 急!!!!!
- ADO应用COMMAND时如何使RECORDSET的RECORDCOUNT有返回值?
- 在一个form中,调用另一个Form里的变量,那个变量该用什么语句申明?
- 一个关于word2000兼容性的问题(急!!!)
so i can't see
so i can't see
so i can't see too
Set object2 = object1
object2 = object12.下面两个表达式的区别在哪里?
If object1 Is object2 Then (...)
If object1 = object2 Then (...)3.函数可以返回对象吗?4.下面这个函数甚么地方有错误,这是一个在某种情况下会出错的bug,到底是什么?Public Function LastPaymentDate( Conn As ADODB.Connection, _
AccountNumber As String) As Date
Dim RS As ADODB.Recordset Set RS = Conn.Execute( _
"SELECT * " _
& "FROM AR " _
& "WHERE AccountNumber = '" & AccountNumber & "' " _
& "ORDER BY PostingDate DESC")
LastPaymentDate = IIf(RS.EOF, 0, RS.Fields("PostingDate").Value)
RS.Close
Set RS = Nothing
End Function5. 如何得到某个月的最后一天,请完成以下函数
Public Function LastDayOfMonth(Mn As Integer, Yr As Integer) As Date
End Function
//Set object2 = object1
//object2 = object1
第一个对,第二个错//2.下面两个表达式的区别在哪里?
//If object1 Is object2 Then (...)
//If object1 = object2 Then (...)
第一个对,第二个错//3.函数可以返回对象吗?
可以/*
4.下面这个函数甚么地方有错误,这是一个在某种情况下会出错的bug,到底是什么?Public Function LastPaymentDate( Conn As ADODB.Connection, _
AccountNumber As String) As Date
Dim RS As ADODB.Recordset Set RS = Conn.Execute( _
"SELECT * " _
& "FROM AR " _
& "WHERE AccountNumber = '" & AccountNumber & "' " _
& "ORDER BY PostingDate DESC")
LastPaymentDate = IIf(RS.EOF, 0, RS.Fields("PostingDate").Value)
RS.Close
Set RS = Nothing
End Function
*/
bug偶8晓得//5. 如何得到某个月的最后一天,请完成以下函数
Public Function LastDayOfMonth(Mn As Integer, Yr As Integer) As Date
LastDayOfMonth = Day(DateSerial(Yr, Mn+1, 0))
End Function
LastDayOfMonth = DateSerial(Yr, Mn+1, 0)
End Function
谢谢 viena,8过,第1,2题是说区别,不是判断对错,可能这样子给人家,不太合适吧
vinea你自己说怎么办?
//Set object2 = object1
//object2 = object1
第一个用于对象赋值,
第二个用于普通变量赋值//2.下面两个表达式的区别在哪里?
//If object1 Is object2 Then (...)
//If object1 = object2 Then (...)
第一个用于比较两个对象,
第二个用于比较两个普通变量
//vinea你自己说怎么办?我跳楼去~
首先我总不能和他说你换个工作吧。
其次对于开卷试题利用个人资源以及网络资源来解决应该勉强也算是种个人能力吧。
第三这不是什么复杂的项目,也不需要索取代码,应该不算窃取劳动果实,何况我还付了100分呢。
:),讨论,讨论,呵呵
100分你觉得多,还给你如何^^ 不过估计有人要气死了,呵呵
看起来比较象哦!
4题中如果conn是一个没有初始化的连接就会出错,而且也没有做错误处理