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:
Ajax Application Generator Generate database and reporting .NET Web apps in minutes. Quickly create visually stunning, feature-rich apps that are easy to customize and ready to deploy. Download Now!
  #1  
Old April 13th, 2003, 09: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, 08: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, 07: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


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





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway