We help IT Professionals succeed at work.

iif rs.eof problem from vb6 to vb.net

993 Views
Last Modified: 2013-11-26
hey guys i am trying to do a basic if statment in vb.net i am usinf the same as i didnt in vb6 but i am guessing that it is a little different in .net

here is the code i am using

Private Sub save_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles save.Click

        Dim rs As New ADODB.Recordset
        Dim sql As String

        sql = "select * from [stock_card] where [stockid] = " & stockn.Text
        Debug.Print(sql)
        If rs.EOF Then
            rs.AddNew()
        Else
            rs.Update()
        End If

        rs.Open(sql, cnn1, ADODB.CursorTypeEnum.adOpenDynamic, ADODB.LockTypeEnum.adLockPessimistic)
Comment
Watch Question

Since you are already shifting to VB .net, may i suggest the use of ADO .net? If you are interested how it is done in ADO .net check this link out. http://www.codeproject.com/cs/database/DatabaseAcessWithAdoNet1.asp

It has a lot of information about how data can be read, represented and written into using ADO .net

If you are lookin for an answer about ur rs.EOF problem, here is a similar discussion going on
http://www.thescripts.com/forum/thread348789.html
Jorge PaulinoIT Pro/Developer
CERTIFIED EXPERT
Top Expert 2008

Commented:
That is past (recordsets), you have to use ADO.NET.

Have a look in here http://samples.gotdotnet.com/quickstart/howto/doc/adoplus/ADOPlusOverview.aspx

Author

Commented:
yea thnaks huys i know it is the past but it is what i know so i was trying to use it, you know move slowly in the the unknown
IT Pro/Developer
CERTIFIED EXPERT
Top Expert 2008
Commented:
Unlock this solution and get a sample of our free trial.
(No credit card required)
UNLOCK SOLUTION
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a sample view!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.