SQL Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsDatabaseSQL 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 17th, 2001, 07:05 PM
Steve Schofield Steve Schofield is offline
Contributing User
ASP Free God 20th Plane (14500 - 14999 posts)
 
Join Date: Dec 2002
Posts: 14,575 Steve Schofield User rank is Corporal (100 - 500 Reputation Level)Steve Schofield User rank is Corporal (100 - 500 Reputation Level)Steve Schofield User rank is Corporal (100 - 500 Reputation Level)Steve Schofield User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 22
Anyone got sample ADO/UPDATE/PARAMETER code?

<i><b>Originally posted by : Jhilb (jhilb@hotmail.com)</b></i><br /><br />I'm looking for sample code that uses ADO to specifically update a database with the createparameter.<br /><br />Such that<br /><br />UPDATE blah SET blahcolumn = 'asdasd' WHERE objId = ?<br /><br />mine don't work right and I can't find any code<br />

Reply With Quote
  #2  
Old June 1st, 2001, 07:35 AM
Steve Schofield Steve Schofield is offline
Contributing User
ASP Free God 20th Plane (14500 - 14999 posts)
 
Join Date: Dec 2002
Posts: 14,575 Steve Schofield User rank is Corporal (100 - 500 Reputation Level)Steve Schofield User rank is Corporal (100 - 500 Reputation Level)Steve Schofield User rank is Corporal (100 - 500 Reputation Level)Steve Schofield User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 22
<i><b>Originally posted by : tomex (tomex@rs520.ddsc.com.tw)</b></i><br />Using command.parameter.add() is better than associating sql string!<br /><br />in ADOConnection:<br /> string strSQL = "INSERT INTO TBL01(ID) VALUES(@ID)";<br /> ADOCommand objCommand = new ADOCommand(strSQL,objADOConn);<br /><br /> // add parameter declare<br /> objCommand.Parameters.Add(new ADOParameter("@ID",ADODBType.VarChar,50));<br /> objCommand.Parameters["@ID"].Value = oID.Value;<br /><br />But It say "Not Declare @ID", but not error in SQLConnection syntax, why?<br /><br />

Reply With Quote
  #3  
Old June 8th, 2001, 03:17 AM
Steve Schofield Steve Schofield is offline
Contributing User
ASP Free God 20th Plane (14500 - 14999 posts)
 
Join Date: Dec 2002
Posts: 14,575 Steve Schofield User rank is Corporal (100 - 500 Reputation Level)Steve Schofield User rank is Corporal (100 - 500 Reputation Level)Steve Schofield User rank is Corporal (100 - 500 Reputation Level)Steve Schofield User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 22
<i><b>Originally posted by : Franc (franckoh@hotmail.com)</b></i><br />Hi.. <br /><br />I am having some trouble associating the parameters with the Command string... <br /><br />In using the below syntax... i am able to update the database..<br /><br /><br />----------------------------------------------<br />ADOCommand Command = new ADOCommand("Update States set STATE_NAME =? where ID = ?",Con);<br />Command.Parameters.Add(new ADOParameter("@Name",ADODBType.VarChar,50));<br />Command.Parameters.Add(new ADOParameter("ORGNAME",ADODBType.VarChar,50));<br />int AUID = (int)e.Item.ItemIndex;<br />Command.Parameters["ORGNAME"].Value=DataGrid1.DataKeys[AUID];<br />NewStates = ((TextBox)e.Item.FindControl("txtStates")).Text; <br />string NewStates = "CDDDyyDDD11DD";<br />Command.Parameters["@Name"].Value = NewStates ;<br />-----------------------------------------------<br /><br />I have tried replacing the Command String with the following but it results in an error..<br /><br />ADOCommand Command = new ADOCommand("Update States set STATE_NAME =@Name where ID = AORGNAME ",Con); <br /><br /><br />Can anyone tell me what is wrong cuz i have seen many codes about this and it seems to be able to work for others....Thanks<br />

Reply With Quote
Reply

Viewing: ASP Free ForumsDatabaseSQL Development > Anyone got sample ADO/UPDATE/PARAMETER code?


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