473,503 Members | 2,150 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.addnew 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 SqlCommandBuilder

Private dv As DataView

Private boolStartup As Boolean = True

formload:

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

da = New SqlDataAdapter(command)

da.Fill(dsGegevens, "gegevens")

da.FillSchema(dsGegevens, SchemaType.Source, "gegevens")

dsGegevens.Tables("gegevens").Columns("id").AutoIn crementSeed = -1

dsGegevens.Tables("gegevens").Columns("id").AutoIn crementStep = -1

dv = dsGegevens.Tables("gegevens").DefaultView

cmGegevens = CType(Me.BindingContext(dv), CurrencyManager)

' cmGegevens.Position = 0

Call koppel() 'add some databindings

cbGegevens = New SqlCommandBuilder(da)

btnnew.click:
cmGegevens.AddNew()

Private Sub koppel()

txtBedrijf.DataBindings.Add(New Binding("text",
dsGegevens.Tables("gegevens"), "bedrijf"))

txtVoornaam.DataBindings.Add(New Binding("text",
dsGegevens.Tables("gegevens"), "voornaam"))

txtNaam.DataBindings.Add(New Binding("text", dsGegevens.Tables("gegevens"),
"naam"))

txtAdres.DataBindings.Add(New Binding("text", dsGegevens.Tables("gegevens"),
"adres"))

txtpostcode.DataBindings.Add(New Binding("text",
dsGegevens.Tables("gegevens"), "postcode"))

txtTelPrive.DataBindings.Add(New Binding("text",
dsGegevens.Tables("gegevens"), "tel_prive"))

End Sub

save button :

Try

cmGegevens.EndCurrentEdit()

da.Update(dsGegevens.Tables("gegevens"))
Catch ex As Exception

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

End Try

da.rowupdated event:

Private Sub da_RowUpdated(ByVal sender As Object, ByVal e As
System.Data.SqlClient.SqlRowUpdatedEventArgs) Handles da.RowUpdated

If e.Status = UpdateStatus.Continue AndAlso (e.StatementType =
StatementType.Insert) Then

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

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

e.Row.AcceptChanges()

End If

End sub




Nov 21 '05 #1
0 745

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

Similar topics

1
3087
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...
5
8411
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...
10
3825
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...
3
6105
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...
5
3481
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...
7
1561
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...
3
2522
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...
4
1553
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
7205
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
7093
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
5594
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,...
1
5022
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...
0
4688
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...
0
3177
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...
0
3168
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1521
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 ...
1
746
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.