473,383 Members | 1,717 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,383 software developers and data experts.

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 2466
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.com...
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(MyDS.Tables(0))

MyAD2.Update(MyDS.Tables(1))

MyAD3.Update(MyDS.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(MyDS.Tables(0).Select("", "", DataViewRowState.Added))

MyAD1.Update(MyDS.Tables(1).Select("", "", DataViewRowState.Added))

MyAD1.Update(MyDS.Tables(2).Select("", "", DataViewRowState.Added))

'now submit the updated rows

MyAD1.Update(MyDS.Tables(0).Select("", "",
DataViewRowState.ModifiedCurrent))

MyAD1.Update(MyDS.Tables(1).Select("", "",
DataViewRowState.ModifiedCurrent))

MyAD1.Update(MyDS.Tables(2).Select("", "",
DataViewRowState.ModifiedCurrent))

'finally submit the deletions from the bottom up

MyAD3.Update(MyDS.Tables(2).Select("", "", DataViewRowState.Deleted))

MyAD2.Update(MyDS.Tables(1).Select("", "", DataViewRowState.Deleted))

MyAD1.Update(MyDS.Tables(0).Select("", "", DataViewRowState.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, "scorpion53061" <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 SchYrSemCourseID, SchYrSemID, Course.CourseID, CourseTitle,
CourseDesc, Unit FROM Course INNER JOIN SchYrSemCourseJoin ON
Course.CourseID = SchYrSemCourseJoin.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.com...
On Tue, 13 Jan 2004 22:15:17 -0600, "scorpion53061" <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 SchYrSemCourseID, SchYrSemID, Course.CourseID, CourseTitle,
CourseDesc, Unit FROM Course INNER JOIN SchYrSemCourseJoin ON
Course.CourseID = SchYrSemCourseJoin.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********@nospam.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, "scorpion53061" <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 SchYrSemCourseID, SchYrSemID, Course.CourseID, CourseTitle,
CourseDesc, Unit FROM Course INNER JOIN SchYrSemCourseJoin ON
Course.CourseID = SchYrSemCourseJoin.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.com...
On Wed, 14 Jan 2004 00:25:28 -0500, "William Ryan"
<do********@nospam.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, "scorpion53061" <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 SchYrSemCourseID, SchYrSemID, Course.CourseID, CourseTitle,
CourseDesc, Unit FROM Course INNER JOIN SchYrSemCourseJoin ON
Course.CourseID = SchYrSemCourseJoin.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
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...
4
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...
2
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...
2
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...
6
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):...
3
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
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...
3
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...
6
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...
2
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...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.