473,657 Members | 2,450 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

vbnet msde

hello,
i'm new programming ado.net and msde
i have the following problem:
when cmgegevens.addn ew is called the binded trextboxes don't clear?
I can edit records, but when i'm trying to add a new one , i get the
following error:
column 'id' is read only .
But when i look at contacts table a new id is created but the fields i
filled in are empty (null) in the database
i have form (contacts entry/edit)
declarations:
Private daPostcode As SqlDataAdapter

Private dsPostcode As New DataSet

Private command As SqlCommand

Private WithEvents da As SqlDataAdapter

Private dsGegevens As New DataSet

Private cmGegevens As CurrencyManager

Private cbGegevens As SqlCommandBuild er

Private dv As DataView

Private boolStartup As Boolean = True

formload:

command = New SqlCommand("sel ect * from dat_contacten", cn)

da = New SqlDataAdapter( command)

da.Fill(dsGegev ens, "gegevens")

da.FillSchema(d sGegevens, SchemaType.Sour ce, "gegevens")

dsGegevens.Tabl es("gegevens"). Columns("id").A utoIncrementSee d = -1

dsGegevens.Tabl es("gegevens"). Columns("id").A utoIncrementSte p = -1

dv = dsGegevens.Tabl es("gegevens"). DefaultView

cmGegevens = CType(Me.Bindin gContext(dv), CurrencyManager )

' cmGegevens.Posi tion = 0

Call koppel() 'add some databindings

cbGegevens = New SqlCommandBuild er(da)

btnnew.click:
cmGegevens.AddN ew()

Private Sub koppel()

txtBedrijf.Data Bindings.Add(Ne w Binding("text",
dsGegevens.Tabl es("gegevens") , "bedrijf"))

txtVoornaam.Dat aBindings.Add(N ew Binding("text",
dsGegevens.Tabl es("gegevens") , "voornaam") )

txtNaam.DataBin dings.Add(New Binding("text", dsGegevens.Tabl es("gegevens") ,
"naam"))

txtAdres.DataBi ndings.Add(New Binding("text", dsGegevens.Tabl es("gegevens") ,
"adres"))

txtpostcode.Dat aBindings.Add(N ew Binding("text",
dsGegevens.Tabl es("gegevens") , "postcode") )

txtTelPrive.Dat aBindings.Add(N ew Binding("text",
dsGegevens.Tabl es("gegevens") , "tel_prive" ))

End Sub

save button :

Try

cmGegevens.EndC urrentEdit()

da.Update(dsGeg evens.Tables("g egevens"))
Catch ex As Exception

MessageBox.Show (ex.Message & vbCrLf & ex.Source & vbCrLf & ex.StackTrace)

End Try

da.rowupdated event:

Private Sub da_RowUpdated(B yVal sender As Object, ByVal e As
System.Data.Sql Client.SqlRowUp datedEventArgs) Handles da.RowUpdated

If e.Status = UpdateStatus.Co ntinue AndAlso (e.StatementTyp e =
StatementType.I nsert) Then

Dim cmdnieuwnr As New SqlCommand("sel ect @@IDENTITY", cn)

e.Row("id") = CType(cmdnieuwn r.ExecuteScalar , Integer)

e.Row.AcceptCha nges()

End If

End sub




Nov 21 '05 #1
0 750

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

Similar topics

1
3097
by: izzy | last post by:
I was wondering if any of you guys can kindly help me in finding all the different versions of MSDE 2000 that came out since it's first release. I expected to find something similar like Sun's archive (http://java.sun.com/products/archive/index.html) for MSDE 2000 too but failed to find after a few hours of browsing at the Microsoft Download Center (http://www.microsoft.com/downloads/search.aspx?displaylang=en). They seem more into...
5
8419
by: Igor Solodovnikov | last post by:
Hi. I am trying to automatically backup transaction log when error 9002 happened. So i have created appropriate job and alert to catch this error. I have two instances of sql server under Windows 2000. One of them is full SQL Server, another is msde. When transaction log is full in full SQL Server error 9002 severity 17 state 2 is logged in sql server log and in Windows Application log. My alert firing my job. All is fine. But when...
10
3842
by: noname | last post by:
MSDE 2000 Release A installed under windows 2000 pro will not communicate with SQL Server Manager nor MS Access on peer computer. Can someone help? Have set DISABLENETWORKPROTOCOLS=0 at install time. Install log shows installation successful.. Control Panel> Admin Tools> Services section shows SQL server instance running.
3
6116
by: *no spam* | last post by:
I want to move my Access 2K database into MSDE. The Access Upsizing Wizard crashes (a known bug wi A2K), so I'm using the following suggested method: Access --> New --> Project (Existing Database) This asks for the name of the .adp file to create and then launches into the Data Link Properties dialog box (so far so good) I select my MSDE server from the drop-down, enter the sa account & passwd, attach a database file and try to...
5
3495
by: Robin Tucker | last post by:
I'm looking for a simple way of telling (inside a stored procedure) if I'm currently using MSDE or a full SQL server. Ideally, there is some pre-defined environment variable that won't cause me too much overhead. The reason I'm doing this is because my system "rolls over" databases when it reaches the 2Gb limit with MSDE, but obviously I want to avoid this overhead if the user installs onto a full SQL server instance. Thanks
7
1570
by: Diogo Alves - Software Developer | last post by:
hi there I am developing a software that needs a database to be shared, I've heard about MSDE, can someone tell me if * There is a newer version than MSDE 2000? * It's possible to use MSDE with C#.Net? * I would like a tutorial or something about deploying MSDE with my application.
3
2531
by: Paul Aspinall | last post by:
Hi I want to package my C# winforms app, to be deployed with MSDE, as easily as possible for the end user. I want to create an MSI or Installshield (prefer MSI), to setup my C# app, together with MSDE (if not already installed), and the MSDE application DB. How can I detect if MSDE is already installed?? Has anyone does this?? How??
4
1561
by: Anthony P. Mancini | last post by:
Does anyone know how to make the MSDE do SQL authentication ? It appears to authenticate using Windows at all times. Thanks, Anthony
0
8421
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8844
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8742
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...
0
7354
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6177
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
5643
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
4173
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
4330
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2743
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.