473,387 Members | 1,745 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Binding TextBox fields to Recordset problem, "Cannot bind to the property"

Can anyone Tell me why this code doesnt let me bind a Textbox field to
the Account# column in my SQL table. It says "Cannot bind to the
property or column ACCOUNT# on the DataSource.
Parameter name: dataMember" I've been looking around and some people
have been using the currency manager. If this is a solution could
someone show me how I can add it to my code to make my binding work
correctly. thanks
Public Class Form1
Dim ConnString As String = "Data Source=CBR10602911;Initial
Catalog=AccuLogic;Persist Security Info=True;User
ID=AccuLogic;Password=acculogic"

Dim ObjConn As New ADODB.Connection

Dim ObjRS As New ADODB.Recordset

Dim strRequest As String = "SELECT * FROM dbo.[WorkList]"
Public Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
With ObjConn

.ConnectionTimeout = 30

.CommandTimeout = 30

.Provider = "SQLOLEDB"

.ConnectionString = ConnString

End With

ObjConn.Open()

ObjRS.Open(strRequest, ObjConn,
ADODB.CursorTypeEnum.adOpenDynamic, ADODB.LockTypeEnum.adLockReadOnly)
ObjRS.MoveFirst()
Me.TextBox1.Text = ObjRS.Fields.Item(0).Value.ToString

Me.TextBox1.DataBindings.Add("Text", ObjRS, "ACCOUNT#")

End Sub

End Class

Oct 17 '06 #1
1 5708
It might be the crosshatch (#). Try changing the column to [AccountNo] and
see what happens.

--
Thiele Enterprises - The Power Is In Your Hands Now!

--
"mike11d11" <mi*******@yahoo.comwrote in message
news:11**********************@i42g2000cwa.googlegr oups.com...
Can anyone Tell me why this code doesnt let me bind a Textbox field to
the Account# column in my SQL table. It says "Cannot bind to the
property or column ACCOUNT# on the DataSource.
Parameter name: dataMember" I've been looking around and some people
have been using the currency manager. If this is a solution could
someone show me how I can add it to my code to make my binding work
correctly. thanks
Public Class Form1
Dim ConnString As String = "Data Source=CBR10602911;Initial
Catalog=AccuLogic;Persist Security Info=True;User
ID=AccuLogic;Password=acculogic"

Dim ObjConn As New ADODB.Connection

Dim ObjRS As New ADODB.Recordset

Dim strRequest As String = "SELECT * FROM dbo.[WorkList]"
Public Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
With ObjConn

.ConnectionTimeout = 30

.CommandTimeout = 30

.Provider = "SQLOLEDB"

.ConnectionString = ConnString

End With

ObjConn.Open()

ObjRS.Open(strRequest, ObjConn,
ADODB.CursorTypeEnum.adOpenDynamic, ADODB.LockTypeEnum.adLockReadOnly)
ObjRS.MoveFirst()
Me.TextBox1.Text = ObjRS.Fields.Item(0).Value.ToString

Me.TextBox1.DataBindings.Add("Text", ObjRS, "ACCOUNT#")

End Sub

End Class
Oct 20 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Guido van Rossum | last post by:
I'm pleased to announce that the Python Software Foundation (PSF) is now accepting donations from individuals and companies interested in supporting our mission to improve the Python programming...
1
by: VitorJOL | last post by:
Hello I have a listbox with a datasource.I want to remove a row from listbox but not remove it from the database. How can i do this ? PROBLEM:"Cannot modify the Items collection when the...
4
by: Bill Coan | last post by:
NOTE: This was posted earlier to vsnet.vstools.office under a different subject line but received no response. I'm having a problem automating Word's Find object from a .NET application, using...
2
by: ME | last post by:
If one wanted to find the documentation for Eval one would look at the documentation for DataBinder.Eval. Where would one find the documentation for the .NET 2.0 Bind method which performs two way...
3
by: Ganesh Muthuvelu | last post by:
Hello, I am trying to use the new "Bind" instead of "DataBinder.Eval" but cannot see a way to use it in code. Can someone help?. Here is my code that is using "DataBinder.Eval" which I want to...
16
by: mj.redfox.mj | last post by:
Can anyone help? I have a textbox which I'm programatically adding by using the following code: txtTest = New TextBox txtTest.ID = "txtLeft" + cntCount.ToString...
1
by: Peter Michaux | last post by:
Hi, I saw Brendan Eich in an online conference video say that in JavaScript 2 that they will lexically bind the "this" keyword of inner functions. He said that currently the execution-time...
2
by: Brook | last post by:
In webform.aspx: <cc:ctlB ID="ctl1" runat="server" Width="200px" /> If set value to width property, I will get a error that say ctlB.Page is null. This control will be fine with no width...
3
by: Tom | last post by:
Can someone please explain the non-working aspect of binding to Width? See code below. Thanks !! -- Tom =================================================== using System; using...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.