473,748 Members | 2,685 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Cannot bind a simple text box

(Type your message here)
Hi,

I'm having a problem with binding a textbox to a dataset. Cananybody figure out what's going on here?

I simply want to update a record. Type in a permit number andsave it to the database. I get the "cannot bind to columnpermitnum ber on datasource" error, or if I add the tablename.colum n name into the binding, a permit number that alreadyexists pops up.

Here is my code:
Dim dbConn As NewOleDbConnect ion("Provider=M icrosoft.Jet.OL EDB.4.0;DataSou rce=C:\Projects \Tests\ParkingP Ermits.mdb")
Dim da As New OleDbDataAdapte r("select * from permits",dbConn )
Dim cb As New OleDbCommandBui lder(da)
Dim ds As New DataSet

da.UpdateComman d = cb.GetUpdateCom mand
da.DeleteComman d = cb.GetDeleteCom mand
da.InsertComman d = cb.GetInsertCom mand
da.Fill(ds, "permits")

txtPermits.Data Bindings.Clear( )
txtPermits.Data Bindings.Add("t ext", ds,"permits.per mitnumber")

da.Update(ds, "permits")

Do I have something in incorrect order?

Thanks,
--------------------------------

-----------------------
Posted by a user from .NET 247 (http://www.dotnet247.com/)

<Id>ibX1YBnxQEy TvHkI3D9avw==</Id>
Nov 20 '05 #1
3 1377
You are calling update after adding the bind, but nothing has changed.
For the record, if your dataset .HasChanges = false, you can call update all
year and nothing will happen. You'll probably want to set up a
bindingcontext and you'll need to change the values before an update will
happen.
http://www.knowdotnet.com/articles/datasetmerge.html

For future reference, add this line before your update in testing, this way
you'll Know if update is actually going to get called (and just b/c it does,
doesn't mean it will work, but if you get a big ugly assertion box, you KNOW
nothing will happen with the Update)

Debug.Assert(Da taSetName.HasCh anges, "No Changes Detected")
"Lori Markle via .NET 247" <an*******@dotn et247.com> wrote in message
news:eV******** ******@TK2MSFTN GP09.phx.gbl...
(Type your message here)
Hi,

I'm having a problem with binding a textbox to a dataset. Can anybody figure
out what's going on here?

I simply want to update a record. Type in a permit number and save it to the
database. I get the "cannot bind to column permitnumber on datasource"
error, or if I add the table name.column name into the binding, a permit
number that already exists pops up.

Here is my code:
Dim dbConn As New
OleDbConnection ("Provider=Micr osoft.Jet.OLEDB .4.0;Data
Source=C:\Proje cts\Tests\Parki ngPErmits.mdb")
Dim da As New OleDbDataAdapte r("select * from permits", dbConn)
Dim cb As New OleDbCommandBui lder(da)
Dim ds As New DataSet

da.UpdateComman d = cb.GetUpdateCom mand
da.DeleteComman d = cb.GetDeleteCom mand
da.InsertComman d = cb.GetInsertCom mand
da.Fill(ds, "permits")

txtPermits.Data Bindings.Clear( )
txtPermits.Data Bindings.Add("t ext", ds, "permits.permit number")

da.Update(ds, "permits")

Do I have something in incorrect order?

Thanks,
--------------------------------

-----------------------
Posted by a user from .NET 247 (http://www.dotnet247.com/)

<Id>ibX1YBnxQEy TvHkI3D9avw==</Id>
Nov 20 '05 #2
OK! Now I'm getting somewhere!

I'll try both answers out and see what happens.

Thanks, William...

Nov 20 '05 #3
My pleasure and I'm glad to hear progress is being made. If you have any
questions, let me know..

Cheers,

Bill

www.devbuzz.com
www.knowdotnet.com

"sparkle" <hr****@hra.co. santa-cruz.ca-dot-us.no-spam.invalid> wrote in
message news:40******** **@127.0.0.1...
OK! Now I'm getting somewhere!

I'll try both answers out and see what happens.

Thanks, William...

Nov 20 '05 #4

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

Similar topics

0
2234
by: Anand Mamuder | last post by:
Greetings, I have a table MYTABLE ( msg_id RAW(24) NOT NULL) , .....) msg_id is the key, If I wanted to select a record using the OCI, the select is failing. I can see that the value exists using sqlplus. I guess I am not doing the Bind correctly. '414D51204D45525420202020202020203F2293C209CBD012' is a example value for msg_id, obtained from the select in SQLplus, when i use the OCI app
7
2563
by: Jed | last post by:
I have a web service method that returns an array of custom objects marked serializeable with fully described public properties. When I bind the results to a DataGrid I can access the properties in the ItemDataBound event of the codebehind but I can't access them declaratively in the HTML code? Here is the code to call the method. net.mysite.www.WSInterface proxy; proxy = new net.mysite.www.WSInterface();
3
1727
by: david | last post by:
I have bind a dataset, DentistDataSet1, to TextBox, txtLastName, by set the textbox property (databindings--> simple binding--> ... -->LastName) and also bind it to a dropdown list, DropdownList1 with datasource (DentistDataSet1), DataMember (Dentists), and DataTextField (DentistID), and AutoPostBack(true). The settings are done by Visual .NET studio 2003. Also I have the following event code and expect the FirstName and LastName would...
0
1724
by: teclioness | last post by:
Hi, I am using gridview for the user to update rows. In a row, there sre two columns, which need to be updated. When the gridview is to be shown, the row should show the values from database. When user clicks on edit link, should display the windows loginId in one column and in second column, show the current datetime. When user clicks on update link, should save these two column values to database as well as other updated field values....
3
3162
by: sck10 | last post by:
Hello, I am trying to bind an arraylist to a FormView DropDownList control in the PreRender state. The error that I get is the following: Databinding methods such as Eval(), XPath(), and Bind() can only be used in the context of a databound control. Any help with this would be appreciated. -- Thanks in advance,
4
3181
by: kkt49 | last post by:
# vim: et sw=4 ts=8 sts from wxPython.wx import * import sys, os, time import pywintypes import win32serviceutil import win32service import win32event import win32process
1
5734
by: mike11d11 | last post by:
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
2
3385
by: duancg | last post by:
Hi, I wonder if someone could help since I wasn't able to find the answer through search. I have a simple .aspx page that shows data from a database table, as a table in UI. Now the data uses 1~12 to represent months, but I want to show them as Jan/.../Dec. So I thought I could write a simple function to convert it and call that function in the Bind expression of DataList. However, I just couldn't find a way to pass the bind...
0
1355
by: sean worlock | last post by:
Hello all, I have googled like crazy for this with no sucess! I have a dataset containing a table with the following fields Table===Widths --------------------------------------------- WidthID---int (primary key) Width------decimal
0
9381
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9332
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9254
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6799
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6078
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4608
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4879
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2791
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2217
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.