netcracker Posted May 8, 2006 Share Posted May 8, 2006 does anyone know how to write only a part of a filed ? say... the first 10 characters!let's say i select a record from a db and i want to write the begining of a fieldthis would write the whole contents of that field.. response.write(rs.fields.item("field")) ..but what if i want to write only the first 10 letters ??i think it shouyld be something like this: response.write(rs.fields.item("descriere_scurta").Read(5)) ...but it's not.please help !thx Link to comment Share on other sites More sharing options...
scott100 Posted May 8, 2006 Share Posted May 8, 2006 Maybe you need the Left(string, number) functionThis example below would return ABC from the alphabet. dim alphabet alphabet="ABCDEFGHIJKLMNOPQRSTUVWXYZ" response.write "<p>The first three characters of the alphabet are: " & left(alphabet,3) & "</p>" Link to comment Share on other sites More sharing options...
scott100 Posted May 8, 2006 Share Posted May 8, 2006 This might work, i havent tested it cause i don't have access to asp just now. response.write left((rs.fields.item("field")),10) Link to comment Share on other sites More sharing options...
netcracker Posted May 8, 2006 Author Share Posted May 8, 2006 ofcourse...!!i knew that !! thx a lot scott !! Link to comment Share on other sites More sharing options...
Dhanajee Posted May 14, 2006 Share Posted May 14, 2006 Link to comment Share on other sites More sharing options...
justsomeguy Posted May 15, 2006 Share Posted May 15, 2006 Just as a note, you should use rs.fields.item("field").value. Don't forget the .value at the end. You will get the value most of the time if you leave off .value, but saying rs.fields.item("field") is a reference to the item object itself, not the value of it. If you are doing comparisons against literal values, you will run into problems comparing an object with a literal. Link to comment Share on other sites More sharing options...
aspnetguy Posted May 15, 2006 Share Posted May 15, 2006 <{POST_SNAPBACK}> What is that??? Please don't spam!Just as a note, you should use rs.fields.item("field").value. Don't forget the .value at the end. You will get the value most of the time if you leave off .value, but saying rs.fields.item("field") is a reference to the item object itself, not the value of it. If you are doing comparisons against literal values, you will run into problems comparing an object with a literal.Oh...how many times have I been there, lol. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now