473,847 Members | 1,806 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

sqladapter caching data?

I am having a problem reading a simple update to the database. Basically
I'm testing a small change to the pubs database -- changing the price of the
Busy Executive's Database Guide from 19.99 to 1997 and back. Unfortunately,
it seems does reflect the change on my web form. Perhaps it's caching the
data retrieved by the SQLDataAdapter? (All of my code is generated by
VS.NET '03.

FYI, it works fine when I test on my developer workstation and database
LocalHost. It's only when I run the application on my development box that
it fails to "notice" the updates. I'm using the "copy project" method to
move it over.

----------------
Public Class Component1
Inherits System.Componen tModel.Componen t
#Region " Component Designer generated code "
Public Sub New(ByVal Container As System.Componen tModel.IContain er)
MyClass.New()
'Required for Windows.Forms Class Composition Designer support
Container.Add(M e)
End Sub
Public Sub New()
MyBase.New()
'This call is required by the Component Designer.
InitializeCompo nent()
'Add any initialization after the InitializeCompo nent() call
End Sub
'Component overrides dispose to clean up the component list.
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Disp ose()
End If
End If
MyBase.Dispose( disposing)
End Sub
'Required by the Component Designer
Private components As System.Componen tModel.IContain er
'NOTE: The following procedure is required by the Component Designer
'It can be modified using the Component Designer.
'Do not modify it using the code editor.
Friend WithEvents SqlDataAdapter1 As System.Data.Sql Client.SqlDataA dapter
Friend WithEvents SqlSelectComman d1 As System.Data.Sql Client.SqlComma nd
Friend WithEvents SqlInsertComman d1 As System.Data.Sql Client.SqlComma nd
Friend WithEvents SqlUpdateComman d1 As System.Data.Sql Client.SqlComma nd
Friend WithEvents SqlDeleteComman d1 As System.Data.Sql Client.SqlComma nd
Friend WithEvents SqlConnection1 As System.Data.Sql Client.SqlConne ction
<System.Diagnos tics.DebuggerSt epThrough()> Private Sub InitializeCompo nent()
Me.SqlDataAdapt er1 = New System.Data.Sql Client.SqlDataA dapter
Me.SqlDeleteCom mand1 = New System.Data.Sql Client.SqlComma nd
Me.SqlConnectio n1 = New System.Data.Sql Client.SqlConne ction
Me.SqlInsertCom mand1 = New System.Data.Sql Client.SqlComma nd
Me.SqlSelectCom mand1 = New System.Data.Sql Client.SqlComma nd
Me.SqlUpdateCom mand1 = New System.Data.Sql Client.SqlComma nd
'
'SqlDataAdapter 1
'
Me.SqlDataAdapt er1.DeleteComma nd = Me.SqlDeleteCom mand1
Me.SqlDataAdapt er1.InsertComma nd = Me.SqlInsertCom mand1
Me.SqlDataAdapt er1.SelectComma nd = Me.SqlSelectCom mand1
Me.SqlDataAdapt er1.TableMappin gs.AddRange(New
System.Data.Com mon.DataTableMa pping() {New
System.Data.Com mon.DataTableMa pping("Table", "titles", New
System.Data.Com mon.DataColumnM apping() {New
System.Data.Com mon.DataColumnM apping("title_i d", "title_id") , New
System.Data.Com mon.DataColumnM apping("title", "title"), New
System.Data.Com mon.DataColumnM apping("price", "price"), New
System.Data.Com mon.DataColumnM apping("notes", "notes"), New
System.Data.Com mon.DataColumnM apping("pubdate ", "pubdate")} )})
Me.SqlDataAdapt er1.UpdateComma nd = Me.SqlUpdateCom mand1
'
'SqlDeleteComma nd1
'
Me.SqlDeleteCom mand1.CommandTe xt = "DELETE FROM titles WHERE (title_id =
@Original_title _id) AND (notes = @Original_n" & _
"otes OR @Original_notes IS NULL AND notes IS NULL) AND (price =
@Original_price " & _
"OR @Original_price IS NULL AND price IS NULL) AND (pubdate =
@Original_pubda te) " & _
"AND (title = @Original_title )"
Me.SqlDeleteCom mand1.Connectio n = Me.SqlConnectio n1
Me.SqlDeleteCom mand1.Parameter s.Add(New
System.Data.Sql Client.SqlParam eter("@Original _title_id",
System.Data.Sql DbType.VarChar, 6, System.Data.Par ameterDirection .Input,
False, CType(0, Byte), CType(0, Byte), "title_id",
System.Data.Dat aRowVersion.Ori ginal, Nothing))
Me.SqlDeleteCom mand1.Parameter s.Add(New
System.Data.Sql Client.SqlParam eter("@Original _notes",
System.Data.Sql DbType.VarChar, 200, System.Data.Par ameterDirection .Input,
False, CType(0, Byte), CType(0, Byte), "notes",
System.Data.Dat aRowVersion.Ori ginal, Nothing))
Me.SqlDeleteCom mand1.Parameter s.Add(New
System.Data.Sql Client.SqlParam eter("@Original _price",
System.Data.Sql DbType.Money, 8, System.Data.Par ameterDirection .Input, False,
CType(0, Byte), CType(0, Byte), "price",
System.Data.Dat aRowVersion.Ori ginal, Nothing))
Me.SqlDeleteCom mand1.Parameter s.Add(New
System.Data.Sql Client.SqlParam eter("@Original _pubdate",
System.Data.Sql DbType.DateTime , 8, System.Data.Par ameterDirection .Input,
False, CType(0, Byte), CType(0, Byte), "pubdate",
System.Data.Dat aRowVersion.Ori ginal, Nothing))
Me.SqlDeleteCom mand1.Parameter s.Add(New
System.Data.Sql Client.SqlParam eter("@Original _title",
System.Data.Sql DbType.VarChar, 80, System.Data.Par ameterDirection .Input,
False, CType(0, Byte), CType(0, Byte), "title",
System.Data.Dat aRowVersion.Ori ginal, Nothing))
'
'SqlConnection1
'
Me.SqlConnectio n1.ConnectionSt ring =
"server=2k01;ui d=sa;pwd=mypass word;database=p ubs"
'
'SqlInsertComma nd1
'
Me.SqlInsertCom mand1.CommandTe xt = "INSERT INTO titles(title_id , title,
price, notes, pubdate) VALUES (@title_id, @ti" & _
"tle, @price, @notes, @pubdate); SELECT title_id, title, price, notes,
pubdate FR" & _
"OM titles WHERE (title_id = @title_id)"
Me.SqlInsertCom mand1.Connectio n = Me.SqlConnectio n1
Me.SqlInsertCom mand1.Parameter s.Add(New
System.Data.Sql Client.SqlParam eter("@title_id ",
System.Data.Sql DbType.VarChar, 6, "title_id") )
Me.SqlInsertCom mand1.Parameter s.Add(New
System.Data.Sql Client.SqlParam eter("@title", System.Data.Sql DbType.VarChar,
80, "title"))
Me.SqlInsertCom mand1.Parameter s.Add(New
System.Data.Sql Client.SqlParam eter("@price", System.Data.Sql DbType.Money, 8,
"price"))
Me.SqlInsertCom mand1.Parameter s.Add(New
System.Data.Sql Client.SqlParam eter("@notes", System.Data.Sql DbType.VarChar,
200, "notes"))
Me.SqlInsertCom mand1.Parameter s.Add(New
System.Data.Sql Client.SqlParam eter("@pubdate" ,
System.Data.Sql DbType.DateTime , 8, "pubdate"))
'
'SqlSelectComma nd1
'
Me.SqlSelectCom mand1.CommandTe xt = "SELECT title_id, title, price, notes,
pubdate FROM titles"
Me.SqlSelectCom mand1.Connectio n = Me.SqlConnectio n1
'
'SqlUpdateComma nd1
'
Me.SqlUpdateCom mand1.CommandTe xt = "UPDATE titles SET title_id = @title_id,
title = @title, price = @price, notes = @" & _
"notes, pubdate = @pubdate WHERE (title_id = @Original_title _id) AND (notes
= @Or" & _
"iginal_not es OR @Original_notes IS NULL AND notes IS NULL) AND (price =
@Origina" & _
"l_price OR @Original_price IS NULL AND price IS NULL) AND (pubdate =
@Original_p" & _
"ubdate) AND (title = @Original_title ); SELECT title_id, title, price,
notes, pub" & _
"date FROM titles WHERE (title_id = @title_id)"
Me.SqlUpdateCom mand1.Connectio n = Me.SqlConnectio n1
Me.SqlUpdateCom mand1.Parameter s.Add(New
System.Data.Sql Client.SqlParam eter("@title_id ",
System.Data.Sql DbType.VarChar, 6, "title_id") )
Me.SqlUpdateCom mand1.Parameter s.Add(New
System.Data.Sql Client.SqlParam eter("@title", System.Data.Sql DbType.VarChar,
80, "title"))
Me.SqlUpdateCom mand1.Parameter s.Add(New
System.Data.Sql Client.SqlParam eter("@price", System.Data.Sql DbType.Money, 8,
"price"))
Me.SqlUpdateCom mand1.Parameter s.Add(New
System.Data.Sql Client.SqlParam eter("@notes", System.Data.Sql DbType.VarChar,
200, "notes"))
Me.SqlUpdateCom mand1.Parameter s.Add(New
System.Data.Sql Client.SqlParam eter("@pubdate" ,
System.Data.Sql DbType.DateTime , 8, "pubdate"))
Me.SqlUpdateCom mand1.Parameter s.Add(New
System.Data.Sql Client.SqlParam eter("@Original _title_id",
System.Data.Sql DbType.VarChar, 6, System.Data.Par ameterDirection .Input,
False, CType(0, Byte), CType(0, Byte), "title_id",
System.Data.Dat aRowVersion.Ori ginal, Nothing))
Me.SqlUpdateCom mand1.Parameter s.Add(New
System.Data.Sql Client.SqlParam eter("@Original _notes",
System.Data.Sql DbType.VarChar, 200, System.Data.Par ameterDirection .Input,
False, CType(0, Byte), CType(0, Byte), "notes",
System.Data.Dat aRowVersion.Ori ginal, Nothing))
Me.SqlUpdateCom mand1.Parameter s.Add(New
System.Data.Sql Client.SqlParam eter("@Original _price",
System.Data.Sql DbType.Money, 8, System.Data.Par ameterDirection .Input, False,
CType(0, Byte), CType(0, Byte), "price",
System.Data.Dat aRowVersion.Ori ginal, Nothing))
Me.SqlUpdateCom mand1.Parameter s.Add(New
System.Data.Sql Client.SqlParam eter("@Original _pubdate",
System.Data.Sql DbType.DateTime , 8, System.Data.Par ameterDirection .Input,
False, CType(0, Byte), CType(0, Byte), "pubdate",
System.Data.Dat aRowVersion.Ori ginal, Nothing))
Me.SqlUpdateCom mand1.Parameter s.Add(New
System.Data.Sql Client.SqlParam eter("@Original _title",
System.Data.Sql DbType.VarChar, 80, System.Data.Par ameterDirection .Input,
False, CType(0, Byte), CType(0, Byte), "title",
System.Data.Dat aRowVersion.Ori ginal, Nothing))
End Sub
#End Region
Public Sub FillDataSet(ByV al dSet As MyDataSet)
SqlDataAdapter1 .Fill(dSet)
End Sub
End Class

_____
DC G
Nov 20 '05 #1
5 1797
* "DC Gringo" <dc******@visio ntechnology.net > scripsit:
I am having a problem reading a simple update to the database. Basically
I'm testing a small change to the pubs database -- changing the price of the
Busy Executive's Database Guide from 19.99 to 1997 and back. Unfortunately,
it seems does reflect the change on my web form. Perhaps it's caching the
data retrieved by the SQLDataAdapter? (All of my code is generated by
VS.NET '03.


Post this question in the ADO.NET group, there you will more likely get
an answer:

<news://msnews.microsof t.com/microsoft.publi c.dotnet.framew ork.adonet>

Web interface:

<http://msdn.microsoft. com/newsgroups/default.asp?url =/newsgroups/loadframes.asp? icp=msdn&slcid= us&newsgroup=mi crosoft.public. dotnet.framewor k.adonet>

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
Nov 20 '05 #2
Cor
Hi DC Gringo,

Did you put your adapter.update in a try catch end try block.
Try
da.Fill(ds)
Catch sqlExc As SqlClient.SqlEx ception
messagebox.show (sqlExc.ToStrin g) 'for a windowsform
Catch exc As Exception
messagebox.show (exc.ToString) ' for a windowsform
Finally
conn.Close()
End Try
End If

I am having a problem reading a simple update to the database. Basically
I'm testing a small change to the pubs database -- changing the price of the Busy Executive's Database Guide from 19.99 to 1997 and back. Unfortunately, it seems does reflect the change on my web form. Perhaps it's caching the
data retrieved by the SQLDataAdapter? (All of my code is generated by
VS.NET '03.

FYI, it works fine when I test on my developer workstation and database
LocalHost. It's only when I run the application on my development box that it fails to "notice" the updates. I'm using the "copy project" method to
move it over.

Nov 20 '05 #3
Actually, what I'm doing is making changes directly to the database via
Enterprise Manager (not via VB code)...then refreshing my browser.

_____
DC G

"Cor" <no*@non.com> wrote in message
news:et******** ******@TK2MSFTN GP10.phx.gbl...
Hi DC Gringo,

Did you put your adapter.update in a try catch end try block.
Try
da.Fill(ds)
Catch sqlExc As SqlClient.SqlEx ception
messagebox.show (sqlExc.ToStrin g) 'for a windowsform
Catch exc As Exception
messagebox.show (exc.ToString) ' for a windowsform
Finally
conn.Close()
End Try
End If

I am having a problem reading a simple update to the database. Basically I'm testing a small change to the pubs database -- changing the price of

the
Busy Executive's Database Guide from 19.99 to 1997 and back.

Unfortunately,
it seems does reflect the change on my web form. Perhaps it's caching the data retrieved by the SQLDataAdapter? (All of my code is generated by
VS.NET '03.

FYI, it works fine when I test on my developer workstation and database
LocalHost. It's only when I run the application on my development box

that
it fails to "notice" the updates. I'm using the "copy project" method to move it over.


Nov 20 '05 #4
Cor
Hi DC,

Than I think you are probably doing the updates on the wrong server.

The pubs database is maybe several times installed.

Cor
Nov 20 '05 #5
Must have been...I tried it again this morning with no problem. <doink!!!>

Thanks for listening!
_____
DC G

"Cor" <no*@non.com> wrote in message
news:%2******** ********@TK2MSF TNGP09.phx.gbl. ..
Hi DC,

Than I think you are probably doing the updates on the wrong server.

The pubs database is maybe several times installed.

Cor

Nov 20 '05 #6

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

Similar topics

2
2024
by: Newbee Adam | last post by:
how to save textbox values to 2 tables using sqladapter I am new with this. Do I need to ADO.net? what is the simplist correct way? or can I write a query in my vb.net form insert table Machine_Count(MachName, CoinsIn) values(txtMachineName(1).Text, txtCoinsIn(1).Text)
6
1565
by: kevin | last post by:
Could someone explain, Caching. I understand Caching as simply saving a copy of something that is unlikely to change and to which you frequently refer as opposed to retrieving a fresh copy every time... like throwing something into Application in ASP3. Now that Iam all "up to date" everyone wants to Cache everything because its "good shit!". How is Cached data any different than data you place in a globally accesible variable?
0
2143
by: Martin | last post by:
Hi. I had a very frustrating afternoon and evening but I have got it all under control now so all of a sudden I am in a good mood. I want to share some insights on output caching with you lot. After looking at the use of the OutputCache directive and tinkering with it a bit I found its usability.very limited. Think of it: it is okay for static content. Well that's nice but no big deal. Static content is cheap anyway, the file system...
10
1477
by: BillGatesFan | last post by:
I'm trying to understand ASP.NET caching. I set the Page Output directive to VaryByParams= None and the duration = 60. Now whenever users hit my web app they can see each others data. Is there anyway to cache the page without this happening or am I using Page Output caching in the wrong situation? It's a data entry web app that I'm trying to increase the performance on.
4
2753
by: DylanM | last post by:
I've seen a few examples on how to cache data in a WinForms GUI, just after some thought on the best solution. The data I'm trying to cache will be generally be small collections of Business Objects (eg Lookup data) 1) Using the Web Cache objects 2) Using AppDomain.CurrentDomain.SetData 3) Using the Caching Application Block
5
7863
by: Raj | last post by:
What is the purpose of file system caching while creating a tablespace? Memory on the test server gets used up pretty quickly after a user executes a complex query(database is already activated), after some investgation i found out that most of it being consumed by filesystem caching... thanks to Liam and Phil Sherman for their valuable suggestions. Is it safe to turn off filesystem caching on every tablespaceon the server(i.e. DIO) ??...
1
3689
by: Hrvoje Voda | last post by:
How to refresh dataset and sqladapter after using store procedure? I tried to call update on sqladapter but it doesn't work. Only when I close program and call it again a change is visible. Hrcko
2
6146
by: George1776 | last post by:
All, I've recently upgraded our production ASP.NET/C# application from framework 1.1 to 2.0. Since then I've been plagued by out-of-memory errors and problems with the cache object (which may simply be a result of being out of memory.) We're running on IIS 5.1 on a single Windows 2000 server. We have a separate database server - SQL Server 2000 64 bit. Session state is stored on the database.
3
1980
by: Gary W. Smith | last post by:
I had a couple questions about data caching. We have a site that gets a huge amount of traffic to a few specific pages that have a lot of data on them (300k hits/hour during peak, about 6-10 data calls per page OR 500 SQL calls per second). Most of the data doesn't change more than once ever 10 minutes. Basically they are data islands with specific content. We have already implemented a singleton that manages a connection pool. This...
0
9730
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
10983
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...
1
10706
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
10338
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
7882
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
7056
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
5911
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
4119
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3164
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.