473,761 Members | 2,293 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to update view?

I am having a problem on how to update view from sql server 2000
database. I have tried dataset and sql dataadapter but no luck. I'm
using this view in datagrid and i want to update the datagrid if there
is changes.

thank in advance
Nov 20 '05 #1
7 2482
jaYPee,

Have a look here, it mentions updatable views...

http://msdn.microsoft.com/library/de...eate2_30hj.asp
Anthony
"jaYPee" <hi******@yahoo .com> wrote in message
news:s0******** *************** *********@4ax.c om...
I am having a problem on how to update view from sql server 2000
database. I have tried dataset and sql dataadapter but no luck. I'm
using this view in datagrid and i want to update the datagrid if there
is changes.

thank in advance

Nov 20 '05 #2
i want to update the datagrid if there
is changes.


Post the code you are using for that sub.

Solutions like these can be found using the VB.NET/ADO.NET Newsgroup Search
Tool at
http://www.kjmsolutions.com/newsgrouptool.htm

This may work. Please do not mass post like this again.

'in the example code below it is assumed that each data

'adapter (MyAD1, MyAD2, MyAd3) have commands for update

'delete and inserts for the respective tables they are

'managing.

MyAD1.Update(My DS.Tables(0))

MyAD2.Update(My DS.Tables(1))

MyAD3.Update(My DS.Tables(2))

'This is a very simplistic code example. If there

'are parent/child relationships involed here then you

'have to break up the process lets say the tables

'are 1 parent to two that is parent to 3. If you have

'updates, inserts, and deletes happening in all of

'the datase's tables then yoyu have to submit things

'in order.

'submit all the inserts first starting from the

'top table on down

MyAD1.Update(My DS.Tables(0).Se lect("", "", DataViewRowStat e.Added))

MyAD1.Update(My DS.Tables(1).Se lect("", "", DataViewRowStat e.Added))

MyAD1.Update(My DS.Tables(2).Se lect("", "", DataViewRowStat e.Added))

'now submit the updated rows

MyAD1.Update(My DS.Tables(0).Se lect("", "",
DataViewRowStat e.ModifiedCurre nt))

MyAD1.Update(My DS.Tables(1).Se lect("", "",
DataViewRowStat e.ModifiedCurre nt))

MyAD1.Update(My DS.Tables(2).Se lect("", "",
DataViewRowStat e.ModifiedCurre nt))

'finally submit the deletions from the bottom up

MyAD3.Update(My DS.Tables(2).Se lect("", "", DataViewRowStat e.Deleted))

MyAD2.Update(My DS.Tables(1).Se lect("", "", DataViewRowStat e.Deleted))

MyAD1.Update(My DS.Tables(0).Se lect("", "", DataViewRowStat e.Deleted))

'the above will work in most situations. This code is untested.

Nov 20 '05 #3
> Have a look here, it mentions updatable views...

http://msdn.microsoft.com/library/de...eate2_30hj.asp

Anthony,

If I am not mistaken, this is referring to SQL "views" as opposed to
dataviews in which we bind to in our applications.
Nov 20 '05 #4
On Tue, 13 Jan 2004 22:15:17 -0600, "scorpion53 061" <Its the end of
the world as we know it@here.com> wrote:
Have a look here, it mentions updatable views...

http://msdn.microsoft.com/library/de...eate2_30hj.asp

Anthony,

If I am not mistaken, this is referring to SQL "views" as opposed to
dataviews in which we bind to in our applications.


this is a views from sql server 2000 i have created. this is the sql:

SELECT SchYrSemCourseI D, SchYrSemID, Course.CourseID , CourseTitle,
CourseDesc, Unit FROM Course INNER JOIN SchYrSemCourseJ oin ON
Course.CourseID = SchYrSemCourseJ oin.CourseID

i used this to create views. i try to use the sqldataadapter to create
a dataset from this views but i can't update it.
Nov 20 '05 #5
jayPee, I think that's going to cause you problems. Since your view is
using joins I think you'd need some sophisticated update logic. Why not
pull the tables down individually and use a DataRelation if you need to
update things.

"jaYPee" <hi******@yahoo .com> wrote in message
news:s4******** *************** *********@4ax.c om...
On Tue, 13 Jan 2004 22:15:17 -0600, "scorpion53 061" <Its the end of
the world as we know it@here.com> wrote:
Have a look here, it mentions updatable views...
http://msdn.microsoft.com/library/de...-us/tsqlref/ts

_create2_30hj.a sp
Anthony,

If I am not mistaken, this is referring to SQL "views" as opposed to
dataviews in which we bind to in our applications.


this is a views from sql server 2000 i have created. this is the sql:

SELECT SchYrSemCourseI D, SchYrSemID, Course.CourseID , CourseTitle,
CourseDesc, Unit FROM Course INNER JOIN SchYrSemCourseJ oin ON
Course.CourseID = SchYrSemCourseJ oin.CourseID

i used this to create views. i try to use the sqldataadapter to create
a dataset from this views but i can't update it.

Nov 20 '05 #6
On Wed, 14 Jan 2004 00:25:28 -0500, "William Ryan"
<do********@nos pam.comcast.net > wrote:
jayPee, I think that's going to cause you problems. Since your view is
using joins I think you'd need some sophisticated update logic. Why not
pull the tables down individually and use a DataRelation if you need to
update things.

don't know what u mean by DataRelation. U mean i can still join table
using DataRelation?

can u give me pls some sample program. i would be very if u have one.

"jaYPee" <hi******@yahoo .com> wrote in message
news:s4******* *************** **********@4ax. com...
On Tue, 13 Jan 2004 22:15:17 -0600, "scorpion53 061" <Its the end of
the world as we know it@here.com> wrote:
>> Have a look here, it mentions updatable views...
>>
>>


http://msdn.microsoft.com/library/de...-us/tsqlref/ts

_create2_30hj. asp
>
>Anthony,
>
>If I am not mistaken, this is referring to SQL "views" as opposed to
>dataviews in which we bind to in our applications.
>


this is a views from sql server 2000 i have created. this is the sql:

SELECT SchYrSemCourseI D, SchYrSemID, Course.CourseID , CourseTitle,
CourseDesc, Unit FROM Course INNER JOIN SchYrSemCourseJ oin ON
Course.CourseID = SchYrSemCourseJ oin.CourseID

i used this to create views. i try to use the sqldataadapter to create
a dataset from this views but i can't update it.


Nov 20 '05 #7
Yes, you can join the local tables, and in many instance, you'll get much
better performance and it'll be much easiser to update do to no unnecessary
redundancies (unless your tables aren't normalized and even then, you'll
still be better off) 2) you can isolate your update logic. This link may
help... http://www.knowdotnet.com/articles/datarelation.html
"jaYPee" <hi******@yahoo .com> wrote in message
news:f1******** *************** *********@4ax.c om...
On Wed, 14 Jan 2004 00:25:28 -0500, "William Ryan"
<do********@nos pam.comcast.net > wrote:
jayPee, I think that's going to cause you problems. Since your view is
using joins I think you'd need some sophisticated update logic. Why not
pull the tables down individually and use a DataRelation if you need to
update things.


don't know what u mean by DataRelation. U mean i can still join table
using DataRelation?

can u give me pls some sample program. i would be very if u have one.

"jaYPee" <hi******@yahoo .com> wrote in message
news:s4******* *************** **********@4ax. com...
On Tue, 13 Jan 2004 22:15:17 -0600, "scorpion53 061" <Its the end of
the world as we know it@here.com> wrote:

>> Have a look here, it mentions updatable views...
>>
>>
http://msdn.microsoft.com/library/de...n-us/tsqlref/t

s_create2_30hj. asp
>
>Anthony,
>
>If I am not mistaken, this is referring to SQL "views" as opposed to
>dataviews in which we bind to in our applications.
>

this is a views from sql server 2000 i have created. this is the sql:

SELECT SchYrSemCourseI D, SchYrSemID, Course.CourseID , CourseTitle,
CourseDesc, Unit FROM Course INNER JOIN SchYrSemCourseJ oin ON
Course.CourseID = SchYrSemCourseJ oin.CourseID

i used this to create views. i try to use the sqldataadapter to create
a dataset from this views but i can't update it.

Nov 20 '05 #8

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

Similar topics

3
2016
by: Mohammed Mazid | last post by:
Can anyone please help me here? Basically I have modified the source code and understood it but when I update a record in the db using a JSP, it gives me an error "The flight you selected does exist." Althought there is not selection going on, instead it is entered, I need it to match the flight in the db using the flightNo. I want all the attributes to be changed apart from the flightNo itself as it is it's associated details I need...
4
10237
by: Surendra | last post by:
I have this query that I need to use in an Update statement to populate a field in the table by the value of Sq ---------------------------------------------------------------------------- Inline View Query: Select Sq from ( Select substr(to_date(End_Date,"DD-MON-YYYY"),4), End_Date, Rank() Over (Partition by substr(to_date(End_Date,"DD-MON-YYYY"),4) Order by End_Date) As Sq
2
2522
by: serge | last post by:
/* This is a long post. You can paste the whole message in the SQL Query Analyzer. I have a scenario where there are records with values pointing to wrong records and I need to fix them using an Update statement. I have a sample code to reproduce my problem. To simplify the scenario I am trying to use Order related tables to explain a little better the tables i have to work with.
2
8334
by: fig000 | last post by:
Hi, I have an application that's running fine on development servers (web and database-sql server 2000). I'm updating a record through a third party component but I don't think the component is the problem. What's happening is that I'm updating fields that are part of view. I'm only updating fields in one table of the view and this works fine in the development environment.
6
4387
by: Eugene | last post by:
Summary: ---------- Updates against UNION ALL view does't do branch elimination, but rather reads all the branches (partitions). The case scenario(DB2 V8.1.4a ESE, AIX 5.2): -------------------------------------------- The UNION ALL view (tv) was built on the following three sample tables (t1,t2,t3)
3
2314
by: Megan | last post by:
hi everybody- it seems like my update query should work. the sql view seems logical. but that might be up to discussion...lol...i'm a newbie! UPDATE , Issue SET .IssueID = . WHERE ((.=.));
3
4133
by: | last post by:
Hi, I have a major problem. I use Windows 2000 highest SP and ACCESS 2000 inside Office 2000 SP-3. I want to use the following simple command inside ACCESS in VBA UPDATE tbl_SATURN_Benutzer SET bool_IstDatensatzAktuell = False, bool_ImportCheckFlag = True, dat_Löschdatum = #01/25/2005 18:38:17# WHERE ((bool_ImportCheckFlag = False) AND (dat_Löschdatum = Null) AND
3
7368
by: V T | last post by:
Hello all, SQL Server 2000 documentation http://www.microsoft.com/technet/prodtechnol/sql/2000/reskit/part10/c3761.mspx states that if view is using "NOT NULL" columns of a base table, then insert/update performed on a view must provide dummy values for those columns, and code of the trigger should ignore them. But I cannot reproduce this restriction. Code below pasted to QueryAnalyser shows that I can not supply dummy values for...
6
5210
by: Greg P | last post by:
I am using VS2005 and have been learning a ton about databinding. I know that when you drag a view from the datasource window (creating a dataGridView) that an update method is not added to the table adaptor. I would like to update the b ase tables thorugh the view. How do i do this? FYI: I have some reserarch on how to handle updating multiple tables and making sure I don't break referential integrity, yet in this case I will not be...
2
2033
by: L.Peter | last post by:
Hi Group, I have a gridview bound to a sqldatasource, this datasource pulls data out from select and update procedures with 10 update parameters the gridview has 15 columns, in edit mode, I want to hide some columns by setting gridvew1.columns.visible = false. so users can focus on 2 editable columns only. The problem is before editing, fields 7-15 have data, after users update column 5-6, data in fields 7-15 is gone. The update...
0
9554
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
9377
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9989
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
7358
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
5266
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
5405
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3913
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
3
3509
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2788
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.