Two Insert Statements

Can i have 2 insert statements in my code inserting data in different tables.

So after i hit submit,the date should go and reside in particular tables.is it possilble?>and if yes..how do i do..any examples /links you can pass me?

View Replies


ADVERTISEMENT

ASP With SQL Insert Statements

Question 1: How can have th asp script automatically convert the date generated by the system to a format which is acceptable by Sybase SQL (yyyymmdd)

Question 2: If the user were to insert a a string containing " ' ", how can I convert it into a special character so that it won't be treated by Sybase SQL as the start/end of a variable?

View Replies View Related

GetRows And Insert/Select Statements

I'm using an SQL statement like the following:

Code:

INSERT INTO table (field) VALUES (value) SELECT @@IDENTITY AS NewIdent;

If I run it through a command prompt (osql.exe) it works fine - it inserts the data and returns the new identity. However, when I try to pass this through my nifty GetRows() function the stupid thing chokes (it acts like a normal INSERT statement has been passed - "ADODB.Recordset (0x800A0E78) Operation is not allowed when the object is closed." on the line where I try to execute GetRows).

I've looked through my ADO documentation and don't see any reason why this should be happening (since it does return data). Due to the small amount of data, I'm going to just use a plain old RecordSet object, but for my own piece of mind does anyone know why it won't treat the returned @@IDENTITY variable like normal data?

View Replies View Related

Asp If Statements

I need some help with some if statements in an asp page I got. My sql statement is:

sql = "select * from courseDesc"

I want to logically diplay all the information on the page. So I inserted this if statement to choose the information I want to dispaly:

<% if rs("courseName") = "whatIsCist" then
response.write(rs("description"))
end if %>

Other courseName titles I need to display the information for further down the page, include: wdt, lan, wan, programming, admissionReq1,2,&3. Does anyone see where my problem is?

View Replies View Related

IF Statements

I'm having problems getting some ASP code to work with a form I'm using. I'm using the script with a multiple page form and want to print a javascript onsubmit value for just one of the forms. I'm getting errors because of the multiple IF statements and I'm not sure how to do this and have the "s show up properly in the output. Can someone tell me how to do this properly?

Code:
<% If step < 5 Then Response.Write " <form action="/script.asp" method="post" name="theForm" id="theForm" & If step < 1 Then Response.Write " onsubmit=""" & "return checkForm(this);" & End If %> & ">" & End If %>
Here is how I want it to output:

<form action="/script.asp" method="post" name="theForm" id="theForm" onsubmit="return checkForm(this);">

View Replies View Related

Use Or And Statements

is there a way to use "or, and" statements in asp,
what i want to do it do 2 seperate checks on the database and if one is true or the other one is true then display some text is this possible and also the same check again on the database but the first statement and the second statement has to be true then display some text is this possible, if yes how would i do it?

View Replies View Related

If Then Statements

I have a field on an asp form called hotelYesNo (YesNo value-pulldown) and a field called roomMate.

I want to do an If Then statement likeso: If hotelYesNo = Yes Then roomMate is required, but if hotelYesNo = No Then roomMate is not required.

I don't know how to get this accomplished in the asp code.

I know how to do this in Microsoft Access but not on a webpage.

How would this be done?

View Replies View Related

If Then Statements

I want to run a query and need to use If then statements such as: If this is output, then run this query. Is there a way to do this?

View Replies View Related

If Statements

I didn't really get a direct answer in the .net forum so I guess I'll just post it here where it should be anyway. Instead of .net I'm just going to probaly stick with 3.0. I want to have several different templates for users to browse a site in.

Since I can't use include files in ASP is there a way I can ONLY load coding in an if statement as it applys to that certain user? I want to enclose multiple images and coding into one file but only load the ONE image/code that pertains to the user. Is this possible using if statements?

View Replies View Related

IF Statements

i am trying to find out if three feilds in a record match, if so send it to another page. basically see code.

Quote: rs.Open "Rental", cs, adOpenDynamic
Do Until rs.EOF
If rs.Fields("MemberID").Value=person And rs.Fields("DVDID").Value=dvd And rs.Fields("Current").Value=true then
Response.redirect "copy.asp?memberid=" & person
End If
rs.MoveNext
Loop

this does not bring up a problem just does not do it any ideas on if staemenst etc in asp thingy.

View Replies View Related

ASP And SQL Statements

I have a (hopefully) simple question that has been giving me some problems. I'm trying to use a simple Select statement to access some data in an access database. In access, the sql statement is as follows:

SELECT TPL_Checklist_Master.[1] From TPL_Checklist_Master

However, when I try to do this on an ASP Page, it always causes an error. I'm assuming this is because of the [] around the field name 1. (I would change the field names, but I don't have control over that).

I know when trying to use a * in the statement Where field LIKE 'A*' I needed to replace the * with a %. I was wondering if something similar had to be done in this case.
I hope my description is clear enought to follow.

View Replies View Related

Asp If Statements

We have currently launched a website in ASP and now want to add some tracking functions.
We have banner ads and emails that we are launching.I would like to create code that will allow me to change the an image and a text link based on where the user is linking in from.

I.e If they clicked on banner xy - then the index page the images would be xy and the text box in another page would be xy. if they clicked on banner zz - then the index page the images would be zz and the text box in another page would be zz.

View Replies View Related

Include Statements

I have been avoiding this issue but it keeps popping up and I cannot figure out a solution. Include statements pathed two or more folders deep they break.

This works:
<!--#include file="../includes/mo_security.asp" -->

This does not work:
<!--#include file="../../includes/mo_security.asp" -->

So basically my site files are limited to one folder deep.
Ex: ROOT/parentFolder/files.htm
One I move another level down the includes do not work anymore:
Ex: ROOT/parentFolder/childFolder/files.htm
I am on a Windows IIS server. Is there any solution to this or is it just a limitation of the include statement?

View Replies View Related

Converting Sql Statements

I have a project to do that requires that I use mysql as the database. I have only used MS Access. The sql will be simple searches.
Is there a drastic difference, or just different punctuation?
Can I find a copy of mysql on the web? If so, is there any advice on installing?

View Replies View Related

VBScript If Statements

Is it possible to wirte a VBScript If statment that outputs different HTML? IE: If **** = True then do this HTML else do this HTML?
How do you do something like that?

View Replies View Related

LIKE Operator For IF Statements?

Basicly I pull the whole column contents and what to test to see if the username is that list. How can I do this in an if statement. I know how to do this kind of thing in SQL (LIKE operator) but I need to test agains two recordsets. Code:

View Replies View Related

<!--#include--> Statements

I am using the ASP include statements for some HTML code, and I have the <body></body> tags included in an outside <!--#include--> file. Is this OK? Or could it mess something up not having the <body></body> tags in the actual page HTML?

View Replies View Related

Sql Update Statements

I am getting an error on my sql update statement and I can't find where it is. I am getting the message, "syntax error in update statement". when I do a response.write on my sql statement this is what I get back

update tblUser set lastname='Ray', firstname='David', address='petal ms', email='david@ray.com', pass='dray', where username='dray'

View Replies View Related

Using If Then Statements In Href Tag

Is it possible to use If Then statements in an a href tag? What I am trying to do is I am using a server side include page of navigation inside of a content management system. I have limitations on what I can manipulate and change. So just using style sheets won't do me the trick. I want to have a navigation link change a different color when you are on that section. I have the menu expanding also using if then statements. When a variable is passed somewhere else on the page as true, the menu expands. I figured I could use this in the same way to make the link change colors. I want to do something like:

<A href="#" <% If Variable_name then%> id="link <% end if %>>Link Here </a>

Is that possible? I know that i can do an If then statement and have 2 different links, one with the id and one without, but I wanted to see if I could simplify it at all. I'm not the best with ASP so there might even be better ways then that...I was just using from the little that I knew.

View Replies View Related

Combine Two Statements

I'd like to combine if possible these two statements drawing from a total of 3 tables.

sql = "SELECT p.Sub_ID, p.Cat_ID, p.Sub_Name, COUNT(c.Sub_ID) as ct FROM
Subs p LEFT JOIN Links c ON p.Sub_Id = c.Sub_Id GROUP BY p.Sub_ID, p.Cat_ID,
p.Sub_Name ORDER BY p.Sub_Name"

sql = "select * from Subs inner join Cats on Cats.Cat_ID=Subs.Cat_ID ORDER
BY Sub_Name"

Is it possible? Am I totaly screwed up for even trying? The goal is to count the relations ships in the Subs and Links table based on Sub_ID, to display needed data from the Subs table, and to display the Cat_name table from the Cats table in relationship to the Cat_ID in both the Cats and Subs Table.

View Replies View Related

Prepared Statements

I am trying to create a prepared statement in ASP, but am having problems with creating the parameter object. I do the following

Set fnParam = peopleUpdate.CreateParameter("@firstname", adVarChar,
adParamInput, 50, peopleSourceRS("firstname"))

But this gives the following error on the browser:

Error Type:
ADODB.Command (0x800A0BB9)

Arguments are of the wrong type, are out of acceptable range, or are in conflict with one another. The server doesn't seem to like adVarChar and adParamInput. I did try
to create the parameter without arguments and then assign the properties, but it gives the same error for .Type and .Direction. What am I doing incorrectly here?

View Replies View Related

Joining Two SQL Statements

I have these two statements and I want to join them to make one query, i don't know how to do it since there are two querystrings that are selecting my data for me.

sSQL = "SELECT * FROM AssemblyName Where AssemblyName = '" & Request.QueryString("assembly") & "'"
Set oRS = oConn.Execute(sSQL)

sSQL = "SELECT * FROM PartsList Where ID = '" & Request.QueryString("one") & "'"
Set oRS2 = oConn.Execute(sSQL)

View Replies View Related

If Statements And Wildcards

if not request("email") like "%@%" or not request("email2") like "%@%" then
response.write "<span class=""whitebox500""><br>THIS DOES NOT APPEAR TO BE A PROPER EMAIL ADDRESS."

response.write "<br><br><Br><input type=button onClick=""javascript:history.back(-1);"" value=""Back to Signup <<""><br><br>"
response.end
end if

and want to wildcard test the request to see if it is properly formatted email with an @ and a dot.

View Replies View Related

Conditional Sql Statements

I have a shopping cart that I want to load items in that come from a huge scrolling form. In other words, when someone clicks on a category in our site, it scrolls out all the items in that category, maybe 30 or more. I have text boxes next to each item so somone can enter a number, then press submit form button at the bottom of the form, and
send those slections to the shopping cart.

The problem is, many of the text boxes are empty, yet they are still being sent to the shopping cart as a quatity of 0. Is there a way for sql to ignore a value if the variable is zero, or only get the sql statement to run if a variable is > 0?

View Replies View Related

How To Prevent Duplicate Values When Using BULK INSERT To Insert CSV To SQL Server?

How to prevent duplicate values when using BULK INSERT to insert CSV to SQL Server? Code:

View Replies View Related

Inserting 2 Different ASP Statements Into One ASP File

I have two ASP statements (<% , %>) that I would like to insert into one ASP file. One of the statements is already inserted in the file and works successfully.
However, when I insert the second ASP statement, the page comes up with an error;-

"Microsoft VBScript compilation error '800a0411'

Name redefined "

I am pretty sure I get this error because both statements are conflicting with one another.
I also can't combine the two statements as I use a DSN connection for one, and a DSN-less connection for another and I connect to 2 different databases.

How might I be able to include both ASP statements within the single ASP file?

A user on another Forum said " there is a variable DIMmed twice.

easiest way is a third include with the variable names in. That way it can be used with any combination of the includes."

View Replies View Related

IF Statements To Update Database

I need help with fixing my code below. It doesn;t work correctly. It works fine when there are 4 featured records. But I want to be able to change one to not be featured (equal to 0). This is not possible with my current code. It shows the same message about me not being able to have more than 4 featured records. Can someone please help me with this?

Code: ....

View Replies View Related

If Statements And Subs Problem With End IF

I am trying to get a page that loads up a different include file depending on which input form button was clicked.

I can get it to work with just one if statement but once I put a second if statement in I get the following error

Quote: Error Type:
Microsoft VBScript compilation (0x800A03F6)
Expected 'End'
/ordersearch/ordersearchresults.asp, line 27

Now no matter where I have though of putting my end if the page now doesn�t work. Does anyone know of the solution??? Code:

View Replies View Related

Using If, ElseIf Statements In Form

I have the folowing code for outputting the contens of a form to an e-mail. I am using AspEmail: PHP Code:

if attend="No" then Mail.Body = ("1")

elseif (attend="Yes" & guest="No") then Mail.Body = ("2")

else Mail.Body = ("3")

end if 

In other words, the e-mail being sent has 3 different formatted options.

Is this going to work, if not, can anyone suggest a work-around?

View Replies View Related

RS.open Statements Fundamentals

Can someone please direct me to an extensive guide on record set instruction statements and their uses? I do not really understand the diff between:

RS.Open SQLstmt, Conn, 2, 3
'RS.Open SQLstmt, Conn, adOpenKeyset, adLockOptimistic, adCmdText

But, when I use the one above in red during a record update I get the following error message:

ADODB.Recordset (0x800A0BB9)
Arguments are of the wrong type, are out of acceptable range, or are in conflict with one another.

View Replies View Related

Passing Variables In SQL Statements

I'm working on a Calendar for my FrontPage web. I've been struggling interminably to write an SQL statement that only calls records based on a variable (today's date, in YYYYMMDD format).

Here's how I've declared the variable:

var mytext = (document.clock.thedate.value)

So now I write my SQL statement:

"SELECT * FROM cal_db WHERE Num_date = '" & Request.QueryString("mytext") & "'"

I know the query string is valid, since I can successfully execute a document.write command that correctly writes the string to my web page. But when I run the SQL, no results are returned.

View Replies View Related

Select A Bunch Of Statements

I want to select a bunch of records where a certain field is equal to the following.
Code:

if game <> "" thensql = "SELECT DISTINCT game, system FROM wallpaper WHERE system = 'ps2' AND system = 'gba' AND system = 'gf' AND system = 'xbox' AND system = 'xbox360' AND system = 'gba' AND system = 'ds' AND system = 'pc' AND system = 'psp' AND system = 'ps3' ORDER by ID DESC LIMIT 0, 10"
Set rschanmedia = Server.CreateObject("ADODB.Recordset")
rschanmedia.Open sql, conn, 3, 3

The script works fine but when I run it it doesn't display any records at all! Yet when I run a script where system is <> to something it works fine! What's wrong?

View Replies View Related

Problem With Using Multiple If Statements...

I use one of the first two if statements by themselves, and comment everything else out, the code works. But when I use more than one of these, i get a "page cannot be displayed" message.

I've also tried condensing if statements into ifelses. Same results. Anyone know why this would be happening? Code:

View Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved