473,395 Members | 1,516 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,395 software developers and data experts.

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.ComponentModel.Component
#Region " Component Designer generated code "
Public Sub New(ByVal Container As System.ComponentModel.IContainer)
MyClass.New()
'Required for Windows.Forms Class Composition Designer support
Container.Add(Me)
End Sub
Public Sub New()
MyBase.New()
'This call is required by the Component Designer.
InitializeComponent()
'Add any initialization after the InitializeComponent() 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.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub
'Required by the Component Designer
Private components As System.ComponentModel.IContainer
'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.SqlClient.SqlDataAdapter
Friend WithEvents SqlSelectCommand1 As System.Data.SqlClient.SqlCommand
Friend WithEvents SqlInsertCommand1 As System.Data.SqlClient.SqlCommand
Friend WithEvents SqlUpdateCommand1 As System.Data.SqlClient.SqlCommand
Friend WithEvents SqlDeleteCommand1 As System.Data.SqlClient.SqlCommand
Friend WithEvents SqlConnection1 As System.Data.SqlClient.SqlConnection
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
Me.SqlDataAdapter1 = New System.Data.SqlClient.SqlDataAdapter
Me.SqlDeleteCommand1 = New System.Data.SqlClient.SqlCommand
Me.SqlConnection1 = New System.Data.SqlClient.SqlConnection
Me.SqlInsertCommand1 = New System.Data.SqlClient.SqlCommand
Me.SqlSelectCommand1 = New System.Data.SqlClient.SqlCommand
Me.SqlUpdateCommand1 = New System.Data.SqlClient.SqlCommand
'
'SqlDataAdapter1
'
Me.SqlDataAdapter1.DeleteCommand = Me.SqlDeleteCommand1
Me.SqlDataAdapter1.InsertCommand = Me.SqlInsertCommand1
Me.SqlDataAdapter1.SelectCommand = Me.SqlSelectCommand1
Me.SqlDataAdapter1.TableMappings.AddRange(New
System.Data.Common.DataTableMapping() {New
System.Data.Common.DataTableMapping("Table", "titles", New
System.Data.Common.DataColumnMapping() {New
System.Data.Common.DataColumnMapping("title_id", "title_id"), New
System.Data.Common.DataColumnMapping("title", "title"), New
System.Data.Common.DataColumnMapping("price", "price"), New
System.Data.Common.DataColumnMapping("notes", "notes"), New
System.Data.Common.DataColumnMapping("pubdate", "pubdate")})})
Me.SqlDataAdapter1.UpdateCommand = Me.SqlUpdateCommand1
'
'SqlDeleteCommand1
'
Me.SqlDeleteCommand1.CommandText = "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_pubdate) " & _
"AND (title = @Original_title)"
Me.SqlDeleteCommand1.Connection = Me.SqlConnection1
Me.SqlDeleteCommand1.Parameters.Add(New
System.Data.SqlClient.SqlParameter("@Original_titl e_id",
System.Data.SqlDbType.VarChar, 6, System.Data.ParameterDirection.Input,
False, CType(0, Byte), CType(0, Byte), "title_id",
System.Data.DataRowVersion.Original, Nothing))
Me.SqlDeleteCommand1.Parameters.Add(New
System.Data.SqlClient.SqlParameter("@Original_note s",
System.Data.SqlDbType.VarChar, 200, System.Data.ParameterDirection.Input,
False, CType(0, Byte), CType(0, Byte), "notes",
System.Data.DataRowVersion.Original, Nothing))
Me.SqlDeleteCommand1.Parameters.Add(New
System.Data.SqlClient.SqlParameter("@Original_pric e",
System.Data.SqlDbType.Money, 8, System.Data.ParameterDirection.Input, False,
CType(0, Byte), CType(0, Byte), "price",
System.Data.DataRowVersion.Original, Nothing))
Me.SqlDeleteCommand1.Parameters.Add(New
System.Data.SqlClient.SqlParameter("@Original_pubd ate",
System.Data.SqlDbType.DateTime, 8, System.Data.ParameterDirection.Input,
False, CType(0, Byte), CType(0, Byte), "pubdate",
System.Data.DataRowVersion.Original, Nothing))
Me.SqlDeleteCommand1.Parameters.Add(New
System.Data.SqlClient.SqlParameter("@Original_titl e",
System.Data.SqlDbType.VarChar, 80, System.Data.ParameterDirection.Input,
False, CType(0, Byte), CType(0, Byte), "title",
System.Data.DataRowVersion.Original, Nothing))
'
'SqlConnection1
'
Me.SqlConnection1.ConnectionString =
"server=2k01;uid=sa;pwd=mypassword;database=pu bs"
'
'SqlInsertCommand1
'
Me.SqlInsertCommand1.CommandText = "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.SqlInsertCommand1.Connection = Me.SqlConnection1
Me.SqlInsertCommand1.Parameters.Add(New
System.Data.SqlClient.SqlParameter("@title_id",
System.Data.SqlDbType.VarChar, 6, "title_id"))
Me.SqlInsertCommand1.Parameters.Add(New
System.Data.SqlClient.SqlParameter("@title", System.Data.SqlDbType.VarChar,
80, "title"))
Me.SqlInsertCommand1.Parameters.Add(New
System.Data.SqlClient.SqlParameter("@price", System.Data.SqlDbType.Money, 8,
"price"))
Me.SqlInsertCommand1.Parameters.Add(New
System.Data.SqlClient.SqlParameter("@notes", System.Data.SqlDbType.VarChar,
200, "notes"))
Me.SqlInsertCommand1.Parameters.Add(New
System.Data.SqlClient.SqlParameter("@pubdate",
System.Data.SqlDbType.DateTime, 8, "pubdate"))
'
'SqlSelectCommand1
'
Me.SqlSelectCommand1.CommandText = "SELECT title_id, title, price, notes,
pubdate FROM titles"
Me.SqlSelectCommand1.Connection = Me.SqlConnection1
'
'SqlUpdateCommand1
'
Me.SqlUpdateCommand1.CommandText = "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_notes 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.SqlUpdateCommand1.Connection = Me.SqlConnection1
Me.SqlUpdateCommand1.Parameters.Add(New
System.Data.SqlClient.SqlParameter("@title_id",
System.Data.SqlDbType.VarChar, 6, "title_id"))
Me.SqlUpdateCommand1.Parameters.Add(New
System.Data.SqlClient.SqlParameter("@title", System.Data.SqlDbType.VarChar,
80, "title"))
Me.SqlUpdateCommand1.Parameters.Add(New
System.Data.SqlClient.SqlParameter("@price", System.Data.SqlDbType.Money, 8,
"price"))
Me.SqlUpdateCommand1.Parameters.Add(New
System.Data.SqlClient.SqlParameter("@notes", System.Data.SqlDbType.VarChar,
200, "notes"))
Me.SqlUpdateCommand1.Parameters.Add(New
System.Data.SqlClient.SqlParameter("@pubdate",
System.Data.SqlDbType.DateTime, 8, "pubdate"))
Me.SqlUpdateCommand1.Parameters.Add(New
System.Data.SqlClient.SqlParameter("@Original_titl e_id",
System.Data.SqlDbType.VarChar, 6, System.Data.ParameterDirection.Input,
False, CType(0, Byte), CType(0, Byte), "title_id",
System.Data.DataRowVersion.Original, Nothing))
Me.SqlUpdateCommand1.Parameters.Add(New
System.Data.SqlClient.SqlParameter("@Original_note s",
System.Data.SqlDbType.VarChar, 200, System.Data.ParameterDirection.Input,
False, CType(0, Byte), CType(0, Byte), "notes",
System.Data.DataRowVersion.Original, Nothing))
Me.SqlUpdateCommand1.Parameters.Add(New
System.Data.SqlClient.SqlParameter("@Original_pric e",
System.Data.SqlDbType.Money, 8, System.Data.ParameterDirection.Input, False,
CType(0, Byte), CType(0, Byte), "price",
System.Data.DataRowVersion.Original, Nothing))
Me.SqlUpdateCommand1.Parameters.Add(New
System.Data.SqlClient.SqlParameter("@Original_pubd ate",
System.Data.SqlDbType.DateTime, 8, System.Data.ParameterDirection.Input,
False, CType(0, Byte), CType(0, Byte), "pubdate",
System.Data.DataRowVersion.Original, Nothing))
Me.SqlUpdateCommand1.Parameters.Add(New
System.Data.SqlClient.SqlParameter("@Original_titl e",
System.Data.SqlDbType.VarChar, 80, System.Data.ParameterDirection.Input,
False, CType(0, Byte), CType(0, Byte), "title",
System.Data.DataRowVersion.Original, Nothing))
End Sub
#End Region
Public Sub FillDataSet(ByVal dSet As MyDataSet)
SqlDataAdapter1.Fill(dSet)
End Sub
End Class

_____
DC G
Nov 20 '05 #1
5 1775
* "DC Gringo" <dc******@visiontechnology.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.microsoft.com/microsoft.public.dotnet.framework.adonet>

Web interface:

<http://msdn.microsoft.com/newsgroups/default.asp?url=/newsgroups/loadframes.asp?icp=msdn&slcid=us&newsgroup=microso ft.public.dotnet.framework.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.SqlException
messagebox.show(sqlExc.ToString) '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**************@TK2MSFTNGP10.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.SqlException
messagebox.show(sqlExc.ToString) '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****************@TK2MSFTNGP09.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
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...
6
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...
0
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. ...
10
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...
4
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...
5
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),...
1
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
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...
3
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...
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
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
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
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,...
0
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...
0
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...
0
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...

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.