Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Visual Basic > VB 6 Visual Basic 6 > Beginning VB 6
|
Beginning VB 6 For coders who are new to Visual Basic, working in VB version 6 (not .NET).
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Beginning VB 6 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old September 11th, 2006, 07:31 AM
Registered User
 
Join Date: Sep 2006
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default How to ad new record through odbc connection

hi,
my database connected thrg adodb and when i am trying to create new record though add button, i am getting error that " Can't assign to read-only property.

my code is
Dim cn As New ADODB.Connection
Dim rs As New ADODB.Connection

Private Sub Command1_Click()
rs.AddNew
rs!proj = Text1.Text
rs!bill_amt = Text2.Text
rs.Update
End Sub
 
Old September 11th, 2006, 07:59 AM
Authorized User
 
Join Date: Sep 2006
Posts: 66
Thanks: 0
Thanked 0 Times in 0 Posts
Default

please check ur code.

Dim cn As New ADODB.Connection
Dim rs As New ADODB.Connection

is it correct .U have no recordset object.

 
Old September 11th, 2006, 08:10 PM
Registered User
 
Join Date: Sep 2006
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I think you have to change your code; instead of
Dim cn As New ADODB.Connection
Dim rs As New ADODB.Connection

you have to write
Dim cn As New ADODB.Connection
Dim rs As New ADODB.Recordset

Hope this works


VRPinhao





Similar Threads
Thread Thread Starter Forum Replies Last Post
ADO Connection problem when not logged in as an Ad Aaron Edwards Access VBA 1 January 3rd, 2008 08:43 AM
Add existing AD user to AD group via ADSI? thiazi Classic ASP Basics 0 August 24th, 2007 09:27 PM
Need Help with ODBC connection johnjohn Visual C++ 2 December 7th, 2004 01:11 PM
ODBC Connection abilodeau Access 3 September 22nd, 2004 09:05 PM
ODBC connection mishaq SQL Server 2000 13 June 16th, 2004 02:55 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.