How would I change the following update statement so that if one of the AreaCode fields was blank, that it passes instead of saying Syntax error in UPDATE statement?
I am trying to write some code that inserts or updates a text field in my SQL Server 2000 database. The SQL statement is created using a submit from a form, and the text is coming from a <textarea>, and therefore being placed into the SQL statement via a Request("field"). However, due to limitations in SQL Server 2000 and text fields, I can not use a simple Update or Insert command with text over 8000 bytes.
Does anybody have any sample statements that will help me update that field with larger amounts of data? I have tried using the WRITETEXT function and UPDATETEXT function with little or no success.
Dim rsCars,mySQL,CAR_ID1,CAR_NAME set rsCars=Server.CreateObject("ADODB.Recordset") mySQL="select * from CAR WHERE (ENDING_DATE < Now() AND MAIL_SENT=0) AND CAR_STATUS=0;" 'mySQL="Update CAR SET MAIL_SENT=1 WHERE (ENDING_DATE < Now() AND MAIL_SENT=0) AND CAR_STATUS=0;" rsCars.CursorType = 2 rsCars.LockType = 3 rsCars.Open mySQL,objConn
'set rsCars = objConn.Execute(mySQL)
But, it doesn't work both ways , and gives the following error:
Microsoft OLE DB Provider for ODBC Drivers (0x80040E10) [Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected 1.
In a form I have one pulldown menu, and one text field. Both MUST get their values from an Access database they connect to. Without submitting the form, how do I change the value appearing in the text field by changing the selection in the pulldown menu? Remember both the text field and the pulldown menu MUST get their values from a database.
What i am trying to do is Update data in a table with data in another table but i want to update 2 fields in the destination table with data from 1 field in another table.
These are the table i have and their fields:
*CUPFirstRound* - Table1 GameId GameDate Home Away HomeScore AwayScore Winner
There are 8 rows in this table, thereofre the GameID's go from 1 to 8 Code:
It shows the data but not like in the data table (Access). I would like that the numbers have a 2 digit decimal behind the comma i.e.123.456,30 and negative numbers should be in red and in brackets i.e. (123.456,30) So, the format should be: $#.##0,00;($#.##0,00)[Red] as I have done it in the table - but not in ASP
Where do I have to enter the format in the ASP code? - or - Where do I have to enter the format in the Html code? Is someone able to write me the coding line?
I have one auto number problem in one table in sql server 2000. I'm inserting new record using insert statement and am not giving any value for that field as its auto number. On the very next statement , I need to know which number it inserted in auto number field for that record??What should be the logic?
What's the best way to handle passing a null value to a number field in my Access database? Right now I am getting an INSERT INTO error when I am doing this. I tried doing the following:
Mon = Replace(Request.form("txtNewMon"),"","0") but it doesn't seem to work. Would you suggest doing an IF satement?
I have a table [table] with two fields [type] and [ID]. I am trying to create a table with the number of IDs per distinct type. So, the return table would be {distinct [type]}, {count per {distinct [type]}. I am stumped; I believe this must be two queries?
I want someone to enter an area code in a field. They would hit search, and it would pull up all records whose phone number starts with that area code entered. Code:
I have a text field in a web page I am working on that seems to be calculating phone numbers before inserting them into an Access database. i.e., 867-5309 will result as -4442 in the Access text field. My guess is that the webserver or client is processing it before inserting it. Is there any way to stop this other than using a validation script?
I need to insert some number into database as text. My problem is if I insert the number (ie. 4.0), the value in the database only show (4). So, is it possible to convert a real number into text number using ASP?
in master batch table i have various master batch like 200701-0001 200701-0002 200701-0003
Now each master batch can have multiple final mixed batch like
200701-0001-01 200701-0001-02 200701-0001-03
and this record is inserted in to fmix table.
so i have a form in which i have a dropdown menu in which all the master batch is listed, i select 200701-0001 and that value is passed to next page where i will enter other fields data and insertion to my fmix_no will be done automatic like 200701-0001-01, 200701-0001-02 and so on,
how to achieve this
so in short each master batch will have more than one final mixed batch.
pls help, also if u have any online contact in yahoo or msn pls send me, i am so confused and badly struck deadline is just couple of hours away. my yahoo id is(E-Mail address blocked: See forum rules) you can PM me i am online right now.
I want To handel the error messages by myself in one part in my script. I know that in VB I can Use the statment - On error resume next And I also know that I can retrive the Error Number In VB with Err.Number.
How can I handel the errors by myself in ASP? I heard about the ASPErr Object, Is it the same thing like the err object in VB?
I am using a Relational database for my site and i have the following tables:
FIXTURES, GAMEDATES
the fields in FIXTURES are:
GameDate Home Away
(All of the above are numerical fields)
the fields in GAMEDATES are:
DateID(integer) GameDate(#Date Field#)
What i have done is in the GAMEDATE field in the FIXTURES table i have used the ID number of the date that i wish to assign to that record - using a LEFT JOIN to display the actual date that is pulled from the GAMEDATES table (That which corresponds to the relevant id used in Fixtures)
The problem is that in some of my code i want to display records using sql and sometimes in the where clause i use the following:
WHERE Fixtures.GameDate<=(Date())
obviously meaning WHERE GAMEDATE is LESS THAN or EQUAL to TODAY.
The thing is when i use the join it does not use the where clause and displays all of the records in the FIXTURES table.
Does any one know how to get around this, i have not received any error messages it just isnt displaying the right data
Im comparing values in a field while doing a loop if sAct<>myData(5,i) then At the end of the loop I make the value of sAct equal the current myData
This will work when comparing other fields withing my recordset (so I know the statement works) but it will not work for the field I want to compare. The only difference with this field is that it has null values. Could this be the problem? if so, how do I deal with nulls?
I have a input form with 5 fields. One of the fields is MajorNo and the other is named Description.
I have a reference table in my MS Access database (tblMajor)that lists the major numbers and their descriptions.
I would like to have the description field in my ASP automatically filled based on the major number entered on the form, so the user will only need to input the major number when submitting to the Access table (tblSalesTotal).
I am trying to pass a hidden field value on a form into another field on the form so that it can then be inserted in the database, to enable me then to reference that number at a later date.
(The hidden value (1 for example) would then automatically get passed to the other input field.)
The code for the text field that allows users to type an number into it for submission to the db is below, but what code do i need within the hidden field to populate this text field below so that users do not have to type the number in? Code:
I have being working with making an edit field over the past few days. The edit function is now working fine. The edit fields that i have are for id, subject, notes, timedate.
All of the edit screens are one line text screens. What I want to do now is increase the size of the notes box to a larger textarea type box to make it easier to edit notes. The notes field in the db is a textarea field. Code:
Well, my script consists in check if the typed code doesn't exist in the DATABASE, but thats not the problem... the problem is that the PAGE1.ASP (that check the code) redirects to the ADD.ASP that will add those codes to the database!
That's the line in page1.asp that redirects to the add.asp. So, when the database is completed empty and, the page1.asp checks that there ins't any problem with it and redirect to the add.asp that doesn't update my database!! So, it continues without any record. But, if the database has, at least, one record, the script works normally without any problem!
Another thing that I noticed is that when I, manually, type the adress Http://127.0.0.1/add.asp?cod_1=176096, for example, and the the database is empty, the script does the UPDATE and adds the code to the table!
I have no idea that the problem is. Does any one have a clue?
I'm not sure if this is an ASP thing, a IIS thing, or a GoDaddy (where my domain is registerd and forwarded from) thing...
First I'll start by saying I run my own Windows XP web server and do all the coding myself..
I've noticed in the past (and never really gave it much thought, because the site works fine), that when I switch pages within my site, that the URL line is not always updated.
For example, I go into the pictures section, view a few pictures, then select the "Home" tab... The URL will stay with the variables that were passed when I was viewing the pictures. Therefore, if I do a "refresh", the page goes back to the pictures I was previously looking at, not the home page.
I've tried this on multiple computers at multiple sites, and with multiple browsers... And seems to happen rather consistantly...
I am looking at updating a notes part of my data base. I am calling two fields (first name and last) from the data base and putting them into read only text box (as i dont want the details changing). All of this is contained within a form. I am also calling a feild from the database called notes which originally has been inserted using a <textarea> tag. The problem i face is that you cant put values into a <textarea> (ie. i can put data from the database into the value tag of a textbox but <textarea> doesn't have a value tag). Due to this i am putting existing notes onto the page as text. Under this i have do have a <textarea> to put the new notes in. The problem i have is that i some how need to store the existing data in the notes field and then add it to the new notes that i will be adding. I just don't know how to put the data i am getting from the notes field in the database into a variable.
Having problems writing an update script because in one of my fields I'm adding a chunk of HTML that contains ' characters. Obviously this throws up an error. How do I get around this?
I have a function below that works fine. It takes a XML dox parses it, etc.
What I need to do is after the update of a record, I need to query the same table again for another record. If it finds this second record, I need to update it.
The problem is I can't get it to work, mostly because I don't completely understand the .open() method. Can I requery and the test for the existance of a returned record - if so how? Code: