Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need help with this method

Status
Not open for further replies.

pinkerton2002

Programmer
Jan 11, 2005
15
NO
<%
If Request.QueryString ("knapp") = "ny" then 'administrator vil legge inn nytt kurs
sql2="select * from Kurs"
response.write sql2
rs3.open sql2, Conn, 3, 3
rs3.Addnew

lengde= RS3("Kurskode").DefineSite
verdi=request.queryString("Knr")
if len (verdi)>lengde then
RS3("Kurskode")=left (verdi,lengde)
Melding= "Innholdet i feltet Kurskode er forkortet"
else
RS3("Kurskode")=verdi
end if
lengde2= RS3(Rom).DefineSite()
verdi2=request.queryString("rom")
if len (verdi2)>lengde2 then
RS3("Rom")=left (verdi2,lengde2)
Melding2= "Innholdet i feltet Kurskode er forkortet"
else
RS3("Rom")=verdi2
end if

response.write lengde
'rs3("Kurskode")= request.querystring("Knr")
rs3("Kursnavn")=request.querystring("kursnavn")
rs3("Klassetrinn")=request.querystring("klassetrinn")
'rs3("Rom")=request.querystring("rom")
rs3("Periode")=request.querystring("periode")
'rs3("Valgfag")=request.querystring("valgfag")

rs3.update
rs3.close
%>

First thing first: Is this a legal method? lengde= RS3("Kurskode").DefineSite? it doesent work, and I get the message Object doesn't support this property or method: 'DefineSite?

The reason i try to have this test is because when I try to insert into the Database without it, I get the error: Microsoft JET Database Engine error '80040e21'

The field is too small to accept the amount of data you attempted to add. Try inserting or pasting less data.

But the field in the database accepts 10 signs, and I insert only three? Why?
Can anybody help me please?

Thank you in advance
 
what is DefineSite (or DefineSite()) supposed to do ? It's not a recordset method that I ever seen before.

Chris.

Indifference will be the downfall of mankind, but who cares?
A website that proves the cobblers kids adage.
Nightclub counting systems

So long, and thanks for all the fish.
 
it is meant to count the numbers allowed in the databasefield. (lengde=length)
Just to assure you, i have opened the database rs with this code:
<%
option explicit
Dim rs, Conn, Kurskode, Kursnavn, Klassetrinn, Rom, Periode, Valgfag, sql, sql2, rs3
response.buffer = false
Set Conn = Server.CreateObject("ADODB.Connection")
Conn.open Application("Timeplan_ConnectionString")
set rs=Server.Createobject ("ADODB.Recordset")
set rs3=Server.Createobject ("ADODB.Recordset")
'RS.open "Select Kurskode, Kursnavn, Klassetrinn, Periode, Romnr, Valgfag FROM Kurs", Conn
'DO while not RS.eof
'Response.write
%>
 
assuming you are using ASP vbScript (based on using the dim and len()) if you have a function called DefineSite() then the function call should be

Code:
lengde = DefineSite(RS3("Kurskode"))


Chris.

Indifference will be the downfall of mankind, but who cares?
A website that proves the cobblers kids adage.
Nightclub counting systems

So long, and thanks for all the fish.
 
i THINK that's a typo, supposed to be RS(field).definedSIZE

especially with the var being lengde (length i think)

[thumbsup2]DreX
aKa - Robert
if all else fails, light it on fire and do the happy dance!
 
which is a Recordset method for returning the size/accuracy of a field depending on what type it is

[thumbsup2]DreX
aKa - Robert
if all else fails, light it on fire and do the happy dance!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top