SQL Server :: Retrieving Posts By Their Tag?
Sep 18, 2010I have the following code in a stored procedure to retrieve all posts:
[Code]....
However, I am having trouble selecting posts by their tag..
I have the following code in a stored procedure to retrieve all posts:
[Code]....
However, I am having trouble selecting posts by their tag..
I am designing a forums website. I have prepared two tables - topic and post
topic - topicid (pk),sub, message (content), replies (count of replies), catid(fk), createdby, createddate, updatedby, updatedon, viewers( count of views)
post - postid(pk), topicid(fk), post (content), createdby, createddate, updatedby, updatedon.
retrieving data from both tables in posts page where the 1st post is in the topic table and rest i.e. replies are in the post table.
Basically, I would like to include my latest Wall posting on my website. But, so far, everything I have read needs the visitor to the site to log-in to Facebook which, in theory, would then retrieve their latest Wall post. In prinicpal, I guess it would be like an RSS Feed.
View 1 Repliestopic - topicid (pk),sub, message (content), catid(fk), createdby, createddate, updatedby, updatedon, viewers( count of views)
post - postid(pk), topicid(fk), post (content), createdby, createddate, updatedby, updatedon.
As i told in my last post, I am designing a forums website. I am not able to design the query to retrieve the topics for a category for example say catid=1. I want to display it in a grid view as done in every forums.
I made some query :
SELECT Topic.Sub, Topic.CreatedBy,COUNT(Topic.viewers) from topic where catid=1
group by Topic.Sub,Topic.CreatedBy
This is for retrieving the topic name from the subject and the createdby giving the topic starter and the total no. of views of that topic.
Now i want to make a query from the post table displaying the last post in the topic and if the post does not exist, i want to display the 1st post from the topic table as the last post done.
There are 2 tables [forumitems] and [forumitemsblog]
forumitems has the itemid,itemdescription,datecreated,whocreated fields
forumsitemsblog has the itemid,blog
I need to show how many posts are in each item description using the itemid so like count(blog) where itemid=itemid
[Code]....
I am using Javascript to alter the innerHTML attribute of a <td> and I need to get that info back in the form submittal. The <td> corrosponds to an <asp:TableCell> on the server-side, where the Text attribute is set to an initial value.
The user cannot enter the value in this particular field. Instead, its value is set by me (via client-side script) based on actions that the user performs. But this field is useless to me if I can't see its value on the server-side as well.
I'd like to avoid using a read-only textbox, because those are difficult to resize dynamically. Can an <asp:Label> be used as form data? Is there any way to achive this without letting the user manually enter the data? Or is there a simpler way to store a string as a variable somewhere and send it back as form-data?
Clicking the save button on my webform that's on our dev server:
http://DevServer/Page.aspx
Posts back to the same page on my local machine:
http://LocalMachine/Page.aspx
How does the DevServer even know my computer exists? I haven't hardcoded any URLS in my code.
I am designing an prototyping an app the needs to store images, similar to facebook. This will be a public facing site and I am not sure how many users I will end up with but what I am looking for is a way to efficiently retrieve them.
So far I am thinking of storing them in SQL Server varbinary columns. I have the upload code and the storage code for that. My concern is retrieving them. I can retireve and build the image tag on the fly but I am worried about having to hit the database for each one.
I have been thinking about getting all images for a user and caching them in the asp.net cache for 10 to 30 seconds. I have never had to do something like this so I would be interested in hearing a few different approaches. Obviously the images can vary in size and I was thinking about defining a size limit, but I haven't gotten that far yet.
i saved files into database. when i'm displaying i wrote code like this
Dim mySqlDataReader As System.Data.SqlClient.SqlDataReader
Dim mySqlCommand As New System.Data.SqlClient.SqlCommand("pl_Resumes", mySqlConnection)
mySqlCommand.CommandType = CommandType.StoredProcedure
[code]...
I know how to retrieve sql server instance name from network,but i want to know is there any way to make sure that while retrieving which should not retrieve the sql server with express edition.
View 19 Replieshow to display image in image control on web page and also in gridview.In sql server image data type is "image".
View 3 RepliesI need to pull data out for a chart and the following is what I have come up with. While it works I know there must be a more elegant way to get the same data in the same format.
[Code]....
MONTH P1 P2 P3
September 5 4 1
October 9 1 3
I am trying to retrieve the ID (auto incremented) form a Table after I do an insert. I have tried using one of the Variable I used to insert with no success. I am inserting a record with Todays Date (if one does not allready exsist) then trying to read that record to get the AutoInc number (DailyTimeRecordID). Where am I going wrong?
Here is my code
[Code]....
I need to retrieve data from a stored procedure, but not from a reader. I need to insert and read to see if there is an error code returned so I can Display It
[Code]....
This inserts data into a stored procedure, since I have a promotion going on, I want to check to see if anyone has tried to create several accounts to try to be Customer #100 or so on, I have achieved this in the procedure, and set RETURN @ErrorCode = 1
Have I Set up the SqlParameter Correctly, or do I now have to declare a direction for each parameter?
I have had problems reading from Stored Procedures and Tutorials Seam Straightforward, but thay are about readers only not Input Output
at present our site has a search function which then populates a grid with results from our catalogue database... I'm trying to implement product availability into the grid, but the stock information is stored in a completely different database in a different location. Both the main search results and the stock levels have to be referenced in the same datasource to get them both in the same grid; does anyone have any thoughts on how to do this? I'm not hugely experienced with SQL, but could I create a view containing aspects of both db's or are these limited to a single db?
View 3 RepliesI am wanting to insert a record into a table in SQL then retrieve its key at the same time, the key is a int that is automatically generated, I read something about the '@@Identity' function, is this what I need? How could I then bind this to a label in the ASP.net page?
View 12 Repliesretrieving data from sql server 2000 database which has four tables. 3 of them has 256 datafields. And I need to retrieve all columns from all table for last 3years. All tables are related through a coman primary key.
So, Total data is 300,000.
I try to use one Calendar, i have example with XML, but i wont to read from SQL,
[Code]....
I am getting always output parameter values null albeit in stored procedure I assigned output param values to 2.both of (MYTOTAL,MYPER) should return 2 but always null.
some code to attempt retrieving multiple output values
[Code]....
In the stord procedure below. I am retreiving all the records for that 1 deal. What I want is to retrieve the most recent record hence the one with the most recent in the AddedDate field.
How can I accomplish this?
(
@DealID int)
AS
SET NOCOUNT ON
SELECT deals_Comments.CommentID, deals_Comments.AddedDate, deals_Comments.UserID, deals_Comments.AddedByEmail, deals_Comments.AddedByIP, deals_Comments.DealID, deals_Comments.Body, deals_Comments.SBody,
ROW_NUMBER() OVER (ORDER BY deals_Comments.AddedDate DESC) AS RowNum
FROM deals_Comments
WHERE deals_Comments.DealID = @DealID
I have a routine that submits a SOAP request using HttpWebRequest and WebResponse. If the SOAP Request fails the server sends back HTTP/1.1 500 Internal Server Error. When I trap the error I have yet to find a way to view the body of the reply which contains the fault code. Is there a way to retrieve the message body when the server returns a 500 internal Server Error? In body of the reply which I am not able to retrieve.
faultstring xml:lang="en-US" Specified argument was out of the range of valid values.
I've got a table where i'm storing a CheckBox.Checked value.
I'm using C# and the value of the field in the table im writing to is a bit.
myDS.InsertParameters["p1"].DefaultValue = CheckBox1.Checked.ToString();
The value placed in my table ends up being either "True" or "False".
So when I try to query the table based on that value with a stored procedure it doesn't work since its looking for a 1 or a 0.
I think the .ToString() is part of the problem but i don't know the syntax to have the value from the CheckBox.Checked to be written as 1s or 0s instead of true or false.
When a user inserts a record it automatically stores the Date and Time that the record was created in column called CreatedDate.
Now what I am looking to do is retrieve the records between two days - which isnt a problem really, I am doing this....
[Code]....
@StartDate and @EndDate come from Calendar selected dates.
@StartTime and @EndTime come from two textboxes.
is it possible to retrieve by using connection.getschema() the description item from a sql server table column, just like it's possible to retrieve the column name, data type, is nullable, column default value, etc? if so, how?
View 3 RepliesI have three tables.
CustomProfile
UserID (pk)
DisplayName
CompanyID
Teams
TeamRecordID (Pk)
TeamID
CompanyID
EmployeesInTeams
UserID
TeamID
I want to assign employees to teams via a gridview control with a templated checkbox.
I have a dropdownlist control to select the TeamID.
I am having problems with the select statement.
The gridview needs to select employees that are not assigned to any teams as well as assigned to other teams. An employee can be assigned to many teams.
What I have been trying is:
cp.UserID, cp.DisplayName, et.TeamIntID, cp.CompanyID