473,386 Members | 2,042 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

coun record from table and display in row wise

idsanjeev
241 100+
sir goodmorning
i wants to count record according to how much reply send by viewer and how much time views.
so what logic and syntax have to use.
Oct 30 '07 #1
10 2209
shweta123
692 Expert 512MB
Hi,

Do you specify the more details about your requirement. Do you want to count how many users visited the page and what is the meaning of reply send by viewer?

sir goodmorning
i wants to count record according to how much reply send by viewer and how much time views.
so what logic and syntax have to use.
Oct 31 '07 #2
idsanjeev
241 100+
thanks for taking response
i wants to count the how much user read the topic and if any user reply on topic then how many reply on that topic .
i wants to display both fild on page in its row after count
Oct 31 '07 #3
shweta123
692 Expert 512MB
Hi,

It depends on how you have done the coding of the page and also on your table structure.

One way is to do the required functionality is

The table which is containing information related to topics which users read and reply , you can add two more fields into it , one to store the information for no of users who read the topic and other to store no of users who replied to the topic.
So each time , when user will click on the link for that topic , retrieve last ReadCount from the db , increment it by one and store that value into database.
In a similar way , after inserting the record into table when user replies for the topic , increment the ReplyCount in database and update the table.


Hope so this will help.
Oct 31 '07 #4
idsanjeev
241 100+
i have don't how to increament if primary key is in table so plz give me i have a field in topmaster for counting reply noofreply and i am using this code but this is worng
code:(asp)
conn.Mode = adModeReadWrite
conn.Open
R.Open "Select * from reply ", conn, adOpenStatic, adLockOptimistic, adCmdText
R.Addnew
R("top_id") =vtopid
R("rep_id") = vrepid
R("rep_by") = request.cookies("userid")
R("rep_dt") = Cdate(date())
R("reply") = vreply
R.UPdate
R.Close
R1.Open "Select no_of_reply from topmaster ", conn, adOpenStatic, adLockOptimistic, adCmdText
R1.Addnew
R1("no_of_reply")=vnoofreply
R1.update
R1.close
error is cannot insert NULL into ("STARTER"."TOPMASTER"."TOP_ID")
so i don't know i can i do it what code have to use for increament in topmaster field insertion in reply table is done but error in topmaster
Oct 31 '07 #5
shweta123
692 Expert 512MB
Hi,
You are getting the error message because
TopId is primary key in the table , so you can not insert a Null value into it.
So please check the value of variable vtopid using Response.Write(vtopid).
and write this code before R.Addnew for getting the latest Topid.

<%
Dim sql

sql = "Select max(topid) as maxtopid from reply"
set rs = conn.execute(sql)
vtopid= rs.Fields("maxtopid")

If isNull(vtopid) or vtopid = ' ' then
vtopid = 0
else
vtopid = vtopid +1
end if
rs.close
%>


i have don't how to increament if primary key is in table so plz give me i have a field in topmaster for counting reply noofreply and i am using this code but this is worng
code:(asp)
conn.Mode = adModeReadWrite
conn.Open
R.Open "Select * from reply ", conn, adOpenStatic, adLockOptimistic, adCmdText
R.Addnew
R("top_id") =vtopid
R("rep_id") = vrepid
R("rep_by") = request.cookies("userid")
R("rep_dt") = Cdate(date())
R("reply") = vreply
R.UPdate
R.Close
R1.Open "Select no_of_reply from topmaster ", conn, adOpenStatic, adLockOptimistic, adCmdText
R1.Addnew
R1("no_of_reply")=vnoofreply
R1.update
R1.close
error is cannot insert NULL into ("STARTER"."TOPMASTER"."TOP_ID")
so i don't know i can i do it what code have to use for increament in topmaster field insertion in reply table is done but error in topmaster
Oct 31 '07 #6
idsanjeev
241 100+
but how can increament noofreply which is in table topmaster and reply is in table reply so what code have to use count reply based on topid and disply on page just like forum .
Nov 1 '07 #7
shweta123
692 Expert 512MB
Hi,

To increment no of replies , add these lines to your code

R1.Open "Select sum(no_of_reply) as reply_count from topmaster ", conn, adOpenStatic, adLockOptimistic, adCmdText

'Get total no replies
vnoofreply = R1("reply_count")

If isNull(vnoofreply) or noofReply ="" then
''''''''If this is the first reply set it to 1
vnoofReply=1
else
vnoofReply= vnoofReply +1
end if

''''''''Update table topmaster with the new value of noofReply
Sql = "Update topmaster set no_of_reply = " & vnoofreply &" where TopicId = " & vtopid &""
conn.execute(Sql)







but how can increament noofreply which is in table topmaster and reply is in table reply so what code have to use count reply based on topid and disply on page just like forum .
Nov 1 '07 #8
idsanjeev
241 100+
hi
its generate error report
unexpected end of SQL command
Nov 1 '07 #9
shweta123
692 Expert 512MB
Hi,

At which line you are getting error? When the errors related to Sql statement come in the ASP page , you can debug it as Response.write(sql), copy that sql statement into the query Analyzer of the server, solve the error there and then put the corrected sql query into the ASP page.


hi
its generate error report
unexpected end of SQL command
Nov 1 '07 #10
idsanjeev
241 100+
error at line when using code for update topmaster for noofreply
conn.execute(Sql)
Nov 1 '07 #11

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: Andrew | last post by:
Hi All, Have come across something weird and am after some help. Say i run this query where rec_id is a column of table arlhrl, select * from arlhrl where rec_id >= 14260 This returns to...
5
by: tdmailbox | last post by:
I have a form with a child form. In the child form there is a list of names that can grow quite large. On the parent form I want to display the first name from the child form. I set up a test...
5
by: BerkshireGuy | last post by:
Hello everyone, I have a bond form that a user uses to enter data. One of my fields, is PolicyNumber. I added some code on the Before Update event of txtPolicyNumber that checks to see if...
12
by: Wadim Grasza | last post by:
I want to store and display (on a form or a report) multiple pictures per record in an access database. The pictures are not stored within the database. They are stored as files and the database...
13
by: ricky.agrawal | last post by:
I'm really not sure how to go about this in Access. What I've created is a table for each location. Those tables are identical in format but different in information. The tables are named after...
0
by: Andy_Khosravi | last post by:
I'm having a problem trying to optimize the performance of one of my A97 databases. I have very slow record navigation after a change I made to the table structure, and I'm not sure how best to...
7
by: john | last post by:
In my form I have a master table and a details table linked 1xM. I can search through the whole parent table but I also like to be able to search through the child table fields to find parent...
4
by: Susan Bricker | last post by:
I have a form that displays record information in Continuous Record display (scrollable list). One of the fields in the record is an Integer value called "rcode" (reason code). But, I don't want...
0
by: solargovind | last post by:
Hello, I have few problem with Dlookup condition. I need to retrieve next record or previous record based on certain condition. The conditions are set in in the combo box. Here, I am trying to...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.