|
bozo65 Beginner
Joined: 27 Feb 2005 Posts: 11
|
Posted: Sun Feb 27, 2005 6:51 pm
Variables and ADO |
hi,
When i assign a zmud variable to a ADO coomand i get this
%tmpcom35369034
eg
target=@rs("Target")
assigns %tmpcom35369304 to target
ie rather than storing the contents of the Target field in target stores what appears to be a point to COM object.
How do you store the field value?
thanks in advance |
|
|
|
nexela Wizard
Joined: 15 Jan 2002 Posts: 1644 Location: USA
|
Posted: Sun Feb 27, 2005 9:10 pm |
Are you accessing it correclty?
|
|
|
|
bozo65 Beginner
Joined: 27 Feb 2005 Posts: 11
|
Posted: Sun Feb 27, 2005 9:23 pm |
nexela wrote: |
Are you accessing it correclty? |
Full trigger script is here. Its finding the row OK and printing the ECHO's out but TARGET is incorrectly assigned.
#VAR rs %comcreate( "ADODB.Recordset")
#VAR connStr "Provider=Microsoft.Jet.OLEDB.4.0;DataSource=mydata.mdb"
#if (@Mobs) {
str=Fred
Sql="SELECT * FROM MobTbl WHERE Name='@str'"
#CALL @rs.Open( @Sql, @ConnStr)
#if (not @rs.eof) {
#ECHO @rs("Name") @rs("ExpGained") @rs("Alignment")
TARGET = @rs( "Target")
#if (@monster=1) {TARGET=monster}
#stop
#play stop.wav
}
#CALL @rs.Close
} |
|
|
|
nexela Wizard
Joined: 15 Jan 2002 Posts: 1644 Location: USA
|
Posted: Sun Feb 27, 2005 10:56 pm |
ya need fields/value I do believe, Also I think the .value is default so you might be able to get away without it
#ECHO @rs.fields("Name").value @rs.fields("ExpGained").value @rs.fields("Alignment").value
TARGET = @rs.fields( "Target").value |
|
|
|
bozo65 Beginner
Joined: 27 Feb 2005 Posts: 11
|
Posted: Mon Feb 28, 2005 10:15 am |
nexela wrote: |
TARGET = @rs.fields( "Target").value |
Hi nexela
Thanks for that youve solved it!
Im probaby pushing it a bit here but
This queryl works fine.
Sql="SELECT * FROM MobTbl WHERE Name='@str''"
This query generates an unknown error
Sql="SELECT * FROM MobTbl WHERE Name='@str' AND Zone='%zonename''" |
|
|
|
Dharkael Enchanter
Joined: 05 Mar 2003 Posts: 593 Location: Canada
|
Posted: Thu Mar 03, 2005 4:30 pm |
from what i can see the problem is that you've mixed quote characters in the second query
after %zonename you have 2 double quote characters instead of a single quote char followed by a double quote char |
|
_________________ -Dharkael-
"No matter how subtle the wizard, a knife between the shoulder blades will seriously cramp his style." |
|
|
|
|
|