Get 1 Record Out Of SQL Express And Use Info In &<head&> And &<body&> Areas, Not In A Grid.
Jan 1, 2008
Hi
Just started using Visual Studio Express 2005 (Web) with Server 2005 Express and I am trying to extract the data from a SQL but cannot find how to connect to and open a SQL recordset so as to use the values of a single record dotted around a page. I would be using the values in the <Head> and <body> areas of the page. The body of the page would utilise standard data grids for sub and sub data, this being no problem.
Below is how I would have retrieved the "EndDate" value from an Access databse under asp.
Set Conn=Server.CreateObject("ADODB.Connection")
Set rs=Server.CreateObject("ADODB.RecordSet")
Conn.Open "DBQ=" & Server.MapPath("../private/Drapers.mdb") & ";Driver={Microsoft Access Driver (*.mdb)};"
rs.open "SELECT * FROM Products where ID = 44", Conn, 3, 3
I am using SQL2k5 with sp2. In have three branch stores in my site each with SQL 2k5 and a master server at headoffice also with SQL 2k5. The sales transactions for each store goes to a table called sales transaction. What I need is that the info from the sales transaction of each branch populate the sales transaction table at the head office, but not vice versa. That is to say the sales transaction table at each branch must have their information alone and no information from any other branch. Only the head office must have sales transactions from all branches in it's table. What type of replication do i use and how do i implement it?
I have created the following SQL snippet that is a very simple mock-up illustrating the problem (I hope!) that I am facing:
-- create table if object_id('tempdb..#tmpdelnotes') is not null drop table #tmpdelnotes
create table #tmpdelnotes( DelNote int identity (1,1) , DelDate date not null, Item int not null, Customer int not null)
[code]...
What I need to retrieve is a unique list of item numbers with information about the latest (DelDate) delivery note. The "Clumsy workaround" works, but is not very pretty when doing multiple table joins. Is it really necessary to use a derived table for this kind of query? Window functions can only exist in the SELECT and ORDER BY clauses, which is understandable since the calculations take place (I would guess) after the aggregations in the HAVING clause.
I was using the MDX Query Builder to create MDX queries for a SSRS report. I'm not sure what happened, but when I tried to create another dataset against the cube, the "Drop Column Fields Here" and "Drop Row Fields Here" areas were no longer available for me to drop attributes onto.
I have restarted VS, rebooted, you name it, I've tried it (short of re-installing). Has anyone encountered this and how did you "fix" it.
BTW: In order to continue working, I decided to use ProClarity to build the MDX for me and when I tried to paste it into the MDX editor, I get the following error: "The query cannot be prepared: The query must have at least one axis. ..". So, as I've seen from other posts, you can't use "any" MDX in the MDX Query Builder.
I try to execute the below statement on a column, I've been trying on a row where subType3 contains this string ",31,32,34,23,55,54,39,44,51,52," without the ",. The column is declared as varchar(MAX) SELECT subType3 FROM aTable WHERE CONTAINS(subType3, '32') The above statement executes and returns the result as expected, BUT if I execute this: SELECT subType3 FROM aTable WHERE CONTAINS(subType3, '55') then nothing is returned. I can't see any real pattern, 32, 34 and 54 returns the row. If I try with any of the others nothing is returned....Why is this? I sort of need to use contains, if I dont wan't to start chopping up the string and patindex or something like that. Patindex works by the way, but when I have many values then it gets a bit cumbersome using anything else than contains. Thanks for any and all help, Cheers! /Eskil
Hi all ! I have a table where there are a number of columns with varchar(20) and varchar(255). I am looking at a table with 4 varchar(255) and 10 varchar(20) 's. I have to estimates the size of the table.I can do that given the rowsize and the number of rows in the table. My problem is what is the kind of over head that I need to take into account when I am dealing with a table with soo many variable length columns when calculating the row size? What is the over head difference between char datatye and varchar datatype? I can't go for char datatypes now. Help and info regarding this is very much appreciated.
Question: How do I return a list of items that matches one or more criteria that I pass in?
Background: A user enters a sales lead (a company is looking for a place to have their event). That lead has a number of criteria elements (start date, end date, city, region, maximum room rate, one or more amenities, etc. - more details below) that should be used when trying to find Hotels that match that criteria. Obviously, some criteria is more important than others (city, start and end date are more important than the maximum room rate) - and it's unlikely that many (if any) of the Hotels will match *all* of the criteria entered by the user. So, I'm looking to return a list of Hotels that match at least one of the criteria - if possible, ordered by how many criteria elements match.
What makes this query particularly difficult, is that some of the criteria to match are stored in multiple tables. For example, each Hotel has "Amenities" (Golf, Spa, etc.) - that are stored in a seperate table. When a user enters a lead, they select which amenities they want to match. Also, a lead specifies a number of rooms to block for each day between the Arrival and Departure date - these numbers can change from day to day - but for this query - I think it's acceptible to get the largest number of rooms needed from any of the days and compare that one number against the "MaxDailyRoomBlock" field of a Hotel (represented by the "Property" table). Also, since a Hotel has different rates defined for each season, the query will have to match the "MaxRate" against the rate of the correct season based on the Arrival and Departure dates. Also, the rate can be within 20% of the stated "MaxRate".
Here are the following variables that will be passed into the query as criteria items: RequestCity, RegionINDEID, ArrivalDate, DepartureDate, MaxRate, MaxTheaterSeating, MaxBanquetSeating, MaxSchoolSeating, MaxBreakoutRooms, MaxRoomBlock
I know this is a huge post - and I sincerly appreciate any help you can provide.
DDL for Tables: *In the DDL.txt attachment
Sample Data: * In the data.txt attachment
Previous Attempts: Unfortunately, I don't even know where to begin, so I haven't tried anything yet.
Expected Results:
PropertyIDNameNumOfMatches ----------------------------------------------- 1Marriot San Diego5 2Hilton San Diego3 3Hilton San Diego Downtown2
I am the IS manager for a medium business. I am also the DBA and the programmer and help desk and trainer etc etc.
In 2003 I embarked on a project which went live in 2005. We contracted to have our order processing system rewritten into SQL. I went from a character based 4GL language called Progress running in a UNIX enviroment to a knock down, drag out, full blown microsoft solution. I have been operating this new system for two years making modest enhancements and improvements as my skills with microsoft are increasing and improving (retraining my brain to think objects)and hiring contractors to do the really cool fun stuff.
I have to learn Server 2003, SQL Server 2005, SQL Express, T-SQL, Replication, Reporting Services, SSIS, IIS, DTS, Visual Source Safe, Visual Studio, VB, C#, ADO.NET and the .NET Framework fits in here too although I don't really know where.
I hope you are starting to understand my feeling of being 'in over my head'. Right now everything is running perfect. I do backups, restore them and create new reports. Basic stuff.
On top of this our company has merged with a larger one and this bigger company does not have a microsoft solution. They have an AS400 home grown application that I do not want to learn. I will not go backwards!!!!! I will loose my job/position in the next couple of years. I want certifications (to get that interview).
I just don't have the skills to back up the certification (I don't want to be one of those exam cram people) I do a plethora of unrelated taks all day long. Not because I have to do them I choose to do them. I like both DBA and Programming.
So, if you were me, and could get certifications and have experience to back them up what would you do first?
I have a table that contains categories, users, modifydates . All three of those fields may be repeated many times.
I need to build a table that contains user, modifydate, oldcategory, newcategory, duration (number of days between modifydates when there is a category change)
I can use the min(modifydate) to get the 1st occurrence of each new category, but I am having trouble populating the oldvalue and then also getting the duration.
Adding to the complexity, I have to take the last entry of a null category prior to category being populated the first time and populate it with the first occurrence of category, Likewise, I have to populate the first occurrence of null after the last occurrence of a popoulated category. In other words, this simulates populated categories prior to first occurrence and after the last occurrence.
I'm trying to write a script that will go against sysprocesses (I think) and find the head of a blocking chain, and how many SPIDs it is blocking on down the line.
I found a reference to a script called head_blockers.sql in the Swynk Scripts database (posted March 2000), but the script appears to no longer be available for download.
Hi I have a huge matrix with 8 columns and then all the data that's generated when choosing a date span. These 8 columns are Topic, Salesperson, Company and so on and then the right part of the matrix grows with values for each month.
My problem is that there are no column headers for the first 8 columns!! How come? What I did to resolve this was to put in a table in the top left cell and then write in the corresponding column header. This works €¦ in IE but not in PDF or Excel. And I really need it when I export it to Excel.
I want to be able to see when records have been added to a table. The issue is we have a DTS job scheduled to run every night. The developer who wrote it password protected it and doesn't work here anymore. I want to add a step to this series of DTS jobs and want to run it just prior to his job. Is there a way to see when the records are being added or when this job is being run? Thanks again, you guys are the best.
Needs to b converted to this (ignore the underscore, used for spacing):
---M-------|-------M & Rx----|---Rx--
The time spans can slide either way.
Data example:
MemberID Eff_Date Term_Date Med_COB Rx_COB 1 20050101 20050912 Y N 1 20050310 20051120 N Y 1 20060101 <null> Y N 1 20060101 <null> N Y
Resulting Records need to be in this format:
MemberID Eff_Date Term_Date Med_COB Rx_COB 1 20050101 20050310 Y N 1 20050311 20050912 Y Y 1 20050913 20051120 N Y 1 20060101 <null> Y Y
Any help with this problem would be greatly appreciated. We are running SQL2K. I like most people,would like to stay away from cursors and loops if possible.
On our datawarehouse server we are regularly having a 1203 error, causing the sql-server to hang. We get this message in the errorlog: Failed Assertion = 'm_activeSdesList.Head () == NULL'. In the knowledgebase I found a bug description that is very lookalike to our problem.
Article: Q240853 FIX: Lock Escalation With Parallel Query May Cause 1203 Error And Server Shutdown
*** part of the article *** SYMPTOMS If a lock escalation occurs while running a parallel query, it is possible to encounter error message 1203 as follows:
spid7 Process 7 unlocking unowned resource: KEY: 13:117575457:2 (35010560ebcd) spid7 Process 7 unlocking unowned resource: KEY: 13:117575457:2 (35010560ebcd) spid7 Error: 1203, Severity: 20, State: 1 spid7 Process ID 7 attempting to unlock unowned resource KEY: 13:117575457:2 (35010560ebcd). spid7 Error: 1203, Severity: 20, State: 1 spid7 Process ID 7 attempting to unlock unowned resource KEY: 13:117575457:2 (35010560ebcd).
The error message included in the error log probably mentions the same lock resource in several of the error messages.
Once the error is printed, an assertion message similar to the following is also printed: 1999-08-09 13:15:26.79 kernel SQL Server Assertion: File: <proc.c>, line=1866 Failed Assertion = 'm_activeSdesList.Head () == NULL'. After a dump of the stack for all threads, the server initiates a shutdown of the SQL Server process. ... *** end ***
You can find the complete article on: http://support.microsoft.com/support/kb/articles/q240/8/53.asp?LN=EN-US&SD=gn&FR=0
We can't use the workaround, because that would shut out parallelism, which is necessary for the project.
There is a fix, but in the article Microsoft says: "A supported fix that corrects this problem is now available from Microsoft, but it has not been fully regression tested and should be applied only to systems experiencing this specific problem.". You understan,d this is not one of my favorite type of fixes...
Does anyone have already installed the fix mentioned? Had any problems with it, or did it cause some other troubles?
Thx, Kurt De Cauwsemaecker Database Administrator Telepolis Antwerpen
Not sure if my description was accurate enough. Here is what I am trying to do. I am learning ASP.Net and am playing around with adding photo albums to my site. I would like a page listing all of the photo albums in a details view. For each album, I want to list the album name and then show a thumbnail of the FIRST photo in that album. When the user clicks on the thumbnail, he will be taken to the page showing all pictures in the album. My problem is coming up with the SELECT statement to return each album and ONLY the first photo in each album. I have 2 tables: albums and photos. Albums has albumid, ownerid and albumname. Photos has photoid, albumid, photoname, and photothumburl. I know I want to SELECT albums.albumid, albums.ownerid, albums.albumname, photo.photoid, photo.photothumburl FROM (I am going to mess up this syntax because I am not in front of my dev computer) albums INNER JOIN photos ON albums.albumid = photos.albumid.... But I do not know how to tell the SELECT to return only the photoid's that are the FIRST photo in the album. I can get it to work if I only use the photos table and just SELECT albumid, MIN(photoid) FROM Photos, but once I add in all the other items I want the query to return (album name, ownerid, photothumburl), I have to put them all as "Group By" and the resulting group of records I get includes all photos regardless of whether they are the first photo in the album or not. Hopefully that makes sense to people. I really would appreciate any help you can give me. So far this stuff is really fun...
I'm new to asp.net and I have gotten quite far with books and such but I'm stuck at this point. I have a web form that is mostly populated with data pulled from AD and all the user does is make a selection in two drop lists and enter their initials to sign. I can't figure out how to insert a record into a table when buttin pressed. I verified that all the data types are correct so it shoud pass the info but its just not going anywhere. I've atached the code below. Thanks,protected void accept_btn_Click(object sender, EventArgs e) { string adPath = LDAP://DC=********,DC=***; //Path to your LDAP directory servermembers adAuth = new members(adPath); string username = Context.User.Identity.Name; string computer_name = System.Environment.MachineName;string comp_type = comptype.SelectedValue.ToString(); string install_type = installtype.SelectedValue.ToString();string date = DateTime.Now.ToString(); string email = adAuth.getemail(Context.User.Identity.Name);string agree = initials_txtbox.Text;string title = "Office"; test_lbl.Text = (username + " " + computer_name + " " + comp_type + " " + install_type + " " + date + " " + email + " " + agree + " " + title);
I was using the msdn tutorial regarding sql database for vb2005 express. In that tutorial, I followed the steps as listed. But the problem is that the save button in my application during run time, it does not work. Furthermore, the code for for saving a record during run time does not work as well.
I have reinstall sql 2005 server and vb2005 express but of no use.
I am currently using VC++/Cli 2005. In a project, I'm using a DataGridView control to show records from a SQL Express 2005 table. Instead of updating a specific item directly within DataGridView control, I would like to open a new form and allow user to update selected record/item within that form. The reason to update this way is conditionned by the fact that I have 3 levels of detail as following:
Level 0 Level 1 Level 2
1:N 1:N Furniture --> Component --> Component
You all understand that update form of Level1 will/must include, as Level0 do, another DataGridView control to display/detail all related items issued from next level. This explains why I can't allow user to update Level 1 directly from DataGridView control.
I've searched in MSDN and even bought a few books on subject but unfortunately I found nothing on how to do it this way. All articles on DataGridView control were only showing how to update record directly from control.
My approach, I think, would be to transmit to my level1 updating form, as a single parameter, the selected DataRow object (or a brand new one if currently adding) issued from DataGridView and let user update it's content. When User finally leaves level0 update form, then I presume that DataGridView corresponding table would be automatically updated according to DataGridView's content.
What would be the proper way to do it? I would certainly appreciate to hear you view on this.
Also, what can I do if I want to refresh DataGridView's content when coming back from update form. Is it done automatically? I would certainly be sure that it reflects the reality, not only when I update it myself but also especially when other users could concurrently update same records?
I am facing a smal formatting issue. the issue i have 7 text boxes attached with each other in the header to show the week days ,i.e Sunday,Monday,Tuesday,Wednesday,Thursay,Friday and Saturday
In Body,i have a matrix which will extend to have 7 columns for the weekdays.
Every thing is fine,Except a small gap between header and footer where i want the 7 text boxes to act as column header names.
I tried with various options like removing the header and placing the text boxes in Body followed by the matrix. 2) placing the seven column headers in a dummy table and attaching that with matrix,
But i am unable to remove the gap between them. if any one of you had experienced the same problem or knows how to solve.it's really a great help
Hi, can any body tell me what is wrong in my sql statement SELECT title, price, Budget = CASE price WHEN price > 20.00 THEN 'Expensive' WHEN price BETWEEN 10.00 AND 19.99 THEN 'Moderate' WHEN price < 10.00 THEN 'Inexpensive' ELSE 'Unknown' END FROM titles it gives me this error Msg 170, Level 15, State 1, Line 3 Line 3: Incorrect syntax near '>'.
but when i use somthing like that i will works fine SELECT Budget
Hello, I was modifying some standard reports of one planning program, by downloading .rdl file from report server and creating a new report project. I have done so many times. Last weak in one of those new reports only header of the report was seen in the report server as I thought I had made some kind of mistake tried to look for it, and after some time the problem fixed itself and I blamed everything on one mixed up connection between the tables in the report, because after removing it the problem fixed itself, but now I think that was just a coincidence. This weak after working fine for about a weak, 6 reports appeared as only headers and footers, they worked fine yesterday and no changes were made to the reports, but in the morning only the header is seen. The reports that are affected are the 4 new ones, and 2 original ones, they are all dealing with the same date just different grouping and sorting. Does anyone know how to fix this problem?
I want to display a value from db in the header section. I have read a couple of information that I should place the value in a in-visible text field an reference it in the header with the ReportItems. This works great with the first page but on the second page the header information are empty (I think because the Textfield is on Page 1 not Page 2)... So is there a way to accomplish that for all pages? Not only the first page....
My second one, hope you don't mind that I post it in the same thread, is:
My Report needs to display the total size of pages in the body. I did not realy found anything useful where I can retrieve from the total size of pages of my reports....
My @subject in an xp_sendmail job is appearing in the email subject where it's supposed to, but also as the first line of the body. Does anyone know of a way to disable this behavior?
I'm generating emails using sp_send_dbmail. Everything works perfectly except for one thing. In the body of the email I need to show a link to a web page (eg http://myweb/login.aspx).
The problem is that the received email shows the "link" as plain text, ie it is not a clickable link. I've tried adding char(13) (and char(10) and both) after the link text but that doesn't help.
Is there a way to make the link text a real link when received by Outlook? (All recipients will be using Outlook if that helps).