Insert/select Statement

How can i get the autonumber(primary key value) from the specific rows when i just insert it.Example

i just insert the member information.
sql="INSERT IMTO register(user,password,address) VALUES (shujuan,841218,singapore)"

so how can i get the autonumber value for this row after i just create it.

View Replies


ADVERTISEMENT

Select Statement

how do you select all the fields in a table that do not contain any data?? I have tried the below and it wont work??

View Replies View Related

Select Statement

I am trying to display a feild from the table. But there is a Type Mismatch error that I am getting. Can anyone please take a look at my code to see what could be wrong.

The error that i am getting is:
Microsoft VBScript runtime error '800a000d'

Type mismatch

/jobapplicationnew.asp, line 1285
Line 1285 is highlighted.

Code:

View Replies View Related

Select Statement

following is my select statment code, works partially fine but the city search is not working.. i.e it gives me list of all hotels that start with the given words whereas it should give me hotels in the given city only. pls help me out. thanks

sSQL = "SELECT * " _
& "FROM [hotel] " _
& "WHERE hotel_name LIKE '%" & Replace(hotel_name, "'", "''") & "%' " _
& "OR hotel_name_e LIKE '%" & Replace(hotel_name, "'", "''") & "%' " _
& "and city = '"&city&"';"

View Replies View Related

Select Statement

the select statement as per the following relationships:

drop1id has 1 to 9 records.
drop2id has 1 to 65 records - FK drop1id will be 1 to 9
drop3id has 1 to 356 records - FK drop2id will be 1 to 65
drop4id has 1 to 356 records - FK drop3id will be 1 to 356.

I am not sure how to retreive the records based on their relationships.

View Replies View Related

Select Statement

does anyone know if its possible to look through a field in a database and see if it contains certain keywords?

i am using a database with a field called MainIssue and i want to see if it contains keywords and if it does, to display the contents. is there a command which would do the same thing as:

select * from maintable where field contains "keywords"

View Replies View Related

Select Statement

I am having problems with a select statement in asp with an access database.
I pull First and Last information from my form
First = Comes from form
Last = Comes from form
I have validated that the form information is being pulled this is where my problem lies.
Code:
SQL = "Select Listing where (FirstName =" & First & ") AND (LastName =" & Last & ")"
For some reason I can not pull the information for the database using this. If I take the AND (LastName =" & Last & ") out I can pull some of the information, but I am looking for a specific last name, first name entry.

View Replies View Related

Select Statement

i have the following tables in my Access database

info1, info2, info3...

all tables have the same columns with the same type of data.

code, description, activated etc.

now i ask the user to enter a code, and then it searches through all the tables for that code. the reason i broke it into smaller tables is there is 10s of thousands of records.
it should find the record that match with the entered code and then if the user wants to, he can edit the data, the date is then automatically saved into the record as well.

View Replies View Related

Select Like Statement

Some of my pages include paging where the variable starts with a certain letter. This worked fine in access but when I try to run it with mysql it says...

Microsoft OLE DB Provider for ODBC Drivers error '80040e37'

[MySQL][ODBC 3.51 Driver][mysqld-4.0.17-nt]You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'SELECT username, status FROM users WHERE username Like 'A%' OR

View Replies View Related

Select Statement

This is really simple but for some reason no recordset is returning. I can't get cat_1 to write. I have run the query against the database in Query Analyser and it runs fine.

Code:
Dim objConn
Set objConn = Server.CreateObject("ADODB.Connection") objConn.ConnectionString = "Driver={SQL Server};Server=nzlakldwhse;Database=Complaints;Uid=elkuser;Pwd=elk;"
objConn.Open

Dim objRS
Dim cat_id, cat_1, cat_2
set objRS = objConn.Execute("select cat_id, cat_1 from complaints.dbo.category a where a.cat_id = '"& request.form("cat_id") &"'")

response.Write(cat_1)
response.End

View Replies View Related

Select Statement

Code:

[advsearch = "Select * from img_inv where item_num like '%" & item_num &"%' or category = '" & category &"' order by item_num"



I want it to be able to search the db by like item number or exactly equal it a given category list.

View Replies View Related

SQL Statement Select

How do i get this to work, i have 3 colums forename, surname and groupname and a colum Genre. I want to select any of the 3 first colums for a name, where the Genre colum is X
this is the statment i have
Code:

"select * FROM autos WHERE forename LIKE '" & session("name") & "' OR surname LIKE '" & session("name") & "' OR groupname LIKE '" & session("name") & "' AND genre LIKE '" & session("genre") & "'"


this is what i get :-
select * FROM autos WHERE forename LIKE 'david' OR surname LIKE 'david' OR groupname LIKE 'david' AND genre LIKE 'Football'
giving David and 'session("name") and Football as session("football")

View Replies View Related

SELECT Statement

I've inherited a database with NULL values in it. I plan on fixing this problem, but for now I need to get this statement working.

cmd = "SELECT * FROM EmpInfo WHERE Interview <> NULL AND status IS NULL OR status <> 'D'"

I'm trying to pull information from the table that need to conform to two different rules. First, there needs to be a value in the INTERVIEW column.

Second, the column STATUS has to be NULL, there can be no D (for delete) in the record.

I can get it to pull the records following the conditions for STATUS, but not for INTERVIEW. I don't work with NULL values very often, so this one is throwing me for a loop.

How can I write that statement to pull only those records that are not NULL in one column, but NULL in another?

View Replies View Related

SELECT Statement

In my company one of the people who works for me has done this:

sqlText = "SELECT products.ProdID, productName, " _
& "productPrice, quantity from products, " _
& "itemsOrdered where " _
& "products.productID = itemsOrdered.productID "_
& "and itemsOrdered.orderID = " & intOrderID

I am just a little unsure what products.ProdID means when later on in the string there is the FROM products?

View Replies View Related

Select Statement

i give the users the option to choose between a daterange to get data from the database.

For example
(RADIO BUTTON) Last 7 days
(RADIO BUTTON) Last month
(RADIO BUTTON) Custom dates

Got the custom dates part to work, but how do i write my select function to select todays date and then go back seven days / 1 month(30days)?

View Replies View Related

Select Statement

In a select statement How do i select the last 10 records in a database?

View Replies View Related

Select Statement

I've got a client who needs some ASP's coded for a Unix server running ChiliSoft, (I had no say in the matter).

I'm banging my head against a wall with the following code:
[VBS]Set objRs = Server.CreateObject("ADODB.Recordset")
Set objRs.ActiveConnection = objConn
objRs.Open "Select * From tblDataBank_Summer Where DatabankID = " & intDatabankID, , adOpenStatic, adLockOptimistic, adCmdTable[/VBS]

I've used this coding elsewhere on other sites with no troubles, but here I keep getting:

ADODB.Recordset.1 error '80004005'

SQLState: 42000
Native Error Code: 1064
[TCX][MyODBC]You have an error in your SQL syntax near 'Select * From tblDataBank_Suummer Where DatabankID = 114 ' at line 1

View Replies View Related

Select Statement

how to do a select statemtn like below

SELECT * FROM table WHERE ID =" & strID & " AND Users LIKE " & strUserName

View Replies View Related

Select Statement

im in need of some guidence regarding select statements. is it possible to combine to select statements?reason for asking is i got this in my access mdb i have to queries one to get the specific member for witch i want the sum from and name is used as creteria then the secon queri is the sum it selfe by using grouped and name as creteria that works well but if i want this on a asp page it becomes little dificult.

well i cant see how can be done as i hoping some of u out there do i was thinking of combining the 2 so the first select gets the info then sum as secon select in a combined select statement i dunno if thats possible. or is there a way i could just use a select all from table and a asp function that can sumerize a field and then put that as a response.write?

View Replies View Related

2 Select Statement

Currently i am doing 2 select statement of SQL

select xxx into #temp

select xxx from tablA inner join #temp
... condition....
... condition....

and this hit error show that as attachment

anyone know y asp cant work with 2 select statement?

View Replies View Related

Select Statement

I keep getting an error when i execute the following statement?

SQL = "SELECT * FROM shop WHERE brand,size = '"& brand & "', '" & size & "'"

View Replies View Related

Select Statement

Why when I add the AND statement, this query doesn´t work? Am I wrong with my syntaxis?

SELECT ID, month, theyear FROM myDB where theyear = 2008 AND month = 1

If I only leave theyear or month it works. If I put AND it doesn´t.

View Replies View Related

Select And Insert Using Asp

I have an LDAP query from asp working correctly. It is returning data fine. Now I need to know how to take this data and then submitt it into the database. Can this be done in
one page and is there any other way to do this without putting a submit button on a page.

Almost like a file that I can pass to the user and he can click it to insert into a database. My way of do it is to simply to put a submit button on the page and when the user hits submit the values selected will go to the database. However the only thing on this page is a submit(kinda useless).

View Replies View Related

Error In Select Statement Using Where And Between

Find below the error I get when the code below is executed

Code:

splitval = split(request.form("start")," ")
dep = splitval(0)

splitval1 = split(request.form("end")," ")
dep1 = splitval1(0)

"SELECT * FROM Info WHERE requestDate BETWEEN dep AND dep1 "

error:
No value given for one or more required parameters.

Can someone help correct the error in the code.

View Replies View Related

Select Statement And DateDiff

i need select statements that counts records from my access database where the time difference is worked out between two fields (datein;dateclosed). Less than 24 hours, >3 days, >5 days, >10 days, >15 days, >30 days, >60 days, >90 days

i am not sure how to construct the statement. If i can just get one, i can hopefully do the rest.

i have now:

strSQL2 = "SELECT Count(*) As Total FROM ptqr WHERE DateDiff('d','" & datein_now & "','" & dateclosed &"')< 1 "

but i get an error:
Microsoft OLE DB Provider for ODBC Drivers error '80040e07'

[Microsoft][ODBC Microsoft Access 97 Driver] Data type mismatch in criteria expression.

/asp/ford_tsb/pscs/reports/charts/Chart5.asp, line 40

View Replies View Related

Long Select Statement

I have a sql statement that contains many fields. I am having problems with the way I am writing the sql statement. Here is an example:Code:

filePath = server.MapPath("directory/dbName.mdb")
Set conn = Sever.CreateObject("ADPDB./Connection")
conn.Provider = "Microsoft.Jet.OLEDB.4.0"
conn.Open filePath

mysql = "SELECT field1,
field2,
field3,

I get an error at the comma on the line "SELECT field1,
What is the proper syntax for line continuation?

View Replies View Related

Portable Sql Select Statement

I have a sql select statement that I would like to place in an include file.

The SQL select statement is fed variables from the page. For Instance Code:

<%
Dim manuID, CatID
manuID=6
CatID="'part','processor'"

Dim objRS
Set objRs = Server.Createobject("ADODB.Recordset")
objRs.Open "SELECT this, that, the other FROM TABLE WHERE Manufacturer='"& manuID & "' and Category in ("& catID &")", objCn, 1, 3
%>

The recordset is used later in the page via a sub procedure. What I did was move the code from DIM objRS to the closing bracket to my "connections" include file and then the sub stopped working. The sub simply displays the results of the recordest in a table.

View Replies View Related

MySQL SELECT Statement

Got a slight issue with a SQL SELECT statement n the slight issue being it kicking a error.

sql = "SELECT O2, Vodafone, Orange, T-Mobile, details1, details2, details3, details4, details5, details6, Type, Price, SimcardsID, Make, Model FROM Simcards"

Thats my SQL statement and the error is:

[MySQL][ODBC 3.51 Driver][mysqld-3.23.49-nt]Unknown column 'T' in 'field list'

I tried stickin [] around the T-Mobile field and it then kicks:

[MySQL][ODBC 3.51 Driver][mysqld-3.23.49-nt]You have an error in your SQL syntax near '[T-Mobile], details1, details2, details3, details4, details5, details6, Type, Pr' at line 1

The line works nicely offline (access database) just not when uploaded.

View Replies View Related

Building A Select Statement

I wish to build a select statement with the "WHERE" part is a variable. I know how to do
Select * FROM table WHERE colum = '" &variable& "' But what if I want the whole part after WHERE to be a variable? with acutal other variables in it.. for instance....

Dim rs, var1, var2, QryString
Set var1 = 1
Set var2 = 2
set QryString = colum1 = '" &var1& "' AND colum2 = '" &var2& "'
rs = Conn.Execute("SELECT * FROM table WHERE QryString")

I am looking for the correct syntax in this case... assume my database connections and such are correct.

View Replies View Related

Select Case Statement

Code:

Function SetAvgClass(val)
If NOT isnull(val) Then
Select Case cint(val)
Case (val < 100)
SetAvgClass = "belowexpected"
Case (val > 100)
SetAvgClass = "aboveexpected"
Case 100
SetAvgClass = "expected"
End Select
Else
SetAvgClass = "belowexpected"
End If
End Function

The only case that seems to be working correctly is thw case 100. am i using incorrect syntax for the > and < statements?

View Replies View Related

Select Count Statement

After i have SLECT COUNT(X) as "A" from....

I want to issue a condition to check for the number of records. this is what i do

Code:

SQL = "select count(*) as "A" from..."
set objRec = objConn.execute(SQL)

if objRec("A") = "3" then

is this statement correct? Doesn't seems working.

View Replies View Related

Getting The ID From An Insert Statement

I am using ASP to talk to an SQL database. Most of my tables have a primary key named 'ID'. Is there a way to grab the ID of a record in the same line as the INSERT statement?

View Replies View Related

Insert SQL Statement

how can i write an insert whereby.my attributes in Mainshift table is shiftdate, line, shift & description. ShiftDate and Line is the primary key.so i want to insert the shiftdate, from today's date until around 31st Dec 2008 and line i want to do a select distinct statement where i will extract from execmaster table.

for the shift i want it to be a default "2". for the description all is all "working day"can anyone help on how to write an insert statement on this?

View Replies View Related







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