PC Review Forums Newsgroups Microsoft DotNet Microsoft VB .NET Binding TextBox fields to Recordset problem, "Cannot bind to the property"

Reply

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

 
Thread Tools Rate Thread
Old 17-10-2006, 11:45 PM   #1
mike11d11
Guest
 
Posts: n/a
Default 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

  Reply With Quote
Old 20-10-2006, 06:45 AM   #2
Ryan S. Thiele
Guest
 
Posts: n/a
Default Re: Binding TextBox fields to Recordset problem, "Cannot bind to the property"

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" <mike11d11@yahoo.com> wrote in message
news:1161125144.901784.269930@i42g2000cwa.googlegroups.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


  Reply With Quote
Reply



Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off