.NET Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsProgramming.NET Development

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 May 16th, 2003, 03:35 AM
hhog hhog is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Mar 2003
Posts: 1 hhog User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Filling a Dataset

An exception is thrown when filling my data set. I thought I read something in the a while back (can't find it now) that mentioned you had to do something "special" when querying using a primary key.... I may be wrong. Anyway here is my snipplet:<br><br><br>//au_id is a primary key<br>sqlDataAdapter1.SelectCommand.CommandText = "Select * from authors where au_id=" + dpdlist.SelectedItem.Value;<br>dsinfo1.Clear();<br>sqlDataAdapter1.Fill(dsinfo1); // exception is thrown here:Syntax error converting the <br> // varchar value '172-32-1176' to a column of data type int<br> //172-32-1176 is the value selected from the dropdownlist<br><br><br>Any help is appreciated.

Reply With Quote
  #2  
Old May 16th, 2003, 04:18 AM
terminator terminator is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: May 2003
Posts: 2 terminator User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
it seems like the value you are getting from your textbox is a string and the au_id in the table is of type int. Both of these should be of the same type. Cast or Convert to make them the same.

Reply With Quote
Reply

Viewing: ASP Free ForumsProgramming.NET Development > Filling a Dataset


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
Stay green...Green IT