Microsoft SQL Server
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsDatabaseMicrosoft SQL Server

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
  #1  
Old April 13th, 2003, 10:11 PM
salmo salmo is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Apr 2003
Posts: 1 salmo User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Dataset in ADO.NET

I am trying to execute the code below but it did not work.<br><br>I want to write the changes to the database but it did not work<br><br>Dim myConn As New SqlClient.SqlConnection("server=ns1;database=dotnet;uid=sa;pwd=hiban")<br> Dim myDataAdapter As New SqlClient.SqlDataAdapter("Select * from vistors", myConn)<br> Dim custDS As DataSet = New DataSet("vistors")<br> Dim DS As New DataSet()<br> Dim datar As New DataRow()<br> myConn.Open()<br><br> myDataAdapter.Fill(custDS, "vistors")<br> custDS.Tables("vistors").Rows(0)(1) = "Alaa Salmo"<br> 'TextBox1.Text = custDS.Tables("vistors").Rows(0)(1)<br> datar = custDS.Tables("vistors").NewRow()<br><br> custDS.AcceptChanges()<br> custDS.GetChanges(DataRowState.Modified)<br> If Not custDS.HasChanges(DataRowState.Modified) Then<br> myDataAdapter.Update(custDS, "vistors")<br> Else<br> MsgBox("No change")<br> End If<br><br><br> myConn.Close()<br><br><br>How can I make the changes to the database ,not only to the recordset

Reply With Quote
  #2  
Old April 20th, 2003, 09:12 PM
bcooley bcooley is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Apr 2003
Posts: 3 bcooley User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
<img border="0" src="/forum/emoticons/smilewinkgrin.gif" height="15" width="15" alt="smilewinkgrin" /> <br>Just looking at the cod, I noticed the following:<br><br>custDS.AcceptChanges()<br>custDS.GetChanges(DataRowState.Modified)<br>If <b>Not</b> custDS.HasChanges(DataRowState.Modified) Then<br>myDataAdapter.Update(custDS, "vistors")<br>Else<br>MsgBox("No change")<br>End If<br><br>I looks to me like your calling the update only if the data <b>hasn't changed</b>.<br> I think if you droped out the "Not" statment it would work. Sometimes a second pair of eyes helps. <img border="0" src="/forum/emoticons/smile.gif" height="15" width="15" alt=":-)" />

Reply With Quote
  #3  
Old April 21st, 2003, 08:16 AM
heemanshudave heemanshudave is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Apr 2003
Posts: 4 heemanshudave User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Have you created update command in the dataadapter<br><br>Heemanshu <img border="0" src="/forum/emoticons/roll.gif" height="15" width="50" alt="roll" />

Reply With Quote
Reply

Viewing: ASP Free ForumsDatabaseMicrosoft SQL Server > Dataset in ADO.NET


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump





 Free IT White Papers!
 
How to Present Effectively Online
This white paper offers practical and actionable advice on the key steps that any presenter should consider as they plan and execute a Webinar or online meeting.

 
Open Source Security Myths
Open Source Software (OSS) is computer software whose source code is available to the general public with relaxed or non-existent intellectual property restrictions (or arrangement such as the public domain), and is usually developed with the input of many contributors.

 
Power and Cooling Capacity Management for Data Centers
This paper describes the principles for achieving power and cooling capacity management.

 
Scalable, Fault-Tolerant NAS for Oracle - The Next Generation
For several years NAS has been evolving as a storage alternative for Oracle databases, and for good reason: NAS is quite often the simplest, most cost-effective storage approach for Oracle. Learn about the benefits that HP's approach to scalable NAS brings to Oracle environments in this comprehensive white paper.

 
Understanding Web Application Security Challenges
This white paper discusses many common threats and preventive measures for Web application security, and explains what you can do to help protect your organization.

 

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2009 by Developer Shed. All rights reserved. DS Cluster 3 Hosted by Hostway
For more Enterprise Application Development news, visit eWeek