Sharepoint 2010 DataViewWebPart with Parameter - sharepoint-2010

So after much frustration I finally created a sql server data source with a single parameter inside of Sharepoint 2010 Designer. The query is a common table expression (CTE) which runs just fine from SQL Server Management Studio. The parameter is an integer (Int32).
What I would like happen is to have a textbox that the user can enter the number in and then the page will retrieve the results of the query.
My questions are:
1) Is this even possible?
2) If so, how do I do it? I have looked high and low and cannot seem to have any luck finding help on something that one would think would be fairly simple.

Related

Running/Printing a report from VB6 application using ACCESS with data loaded from Sql

I have a simple VB6 application where I input information and store it on SQL SERVER. I went ahead and linked Access 2007 and SQL Server so that all my tables are in Access for report generating purposes. I created a mock report, and was able to generate a report for all users from the sql Table (from Visual basic) Now my question is this, on the report form in the VB application, I have a combobox that's being populated with Client Names from the sql server. What I need to do is allow the user to choose a name from the combobox and click PRINT and allow them to only generate the report for that one user. The names in the combobox have ID's assigned to them. I'm having a hard time coming up with a way to edit the query in access (where id=17) from VB to allow the report to be only generated for one user. Thanks for any and all help!
Dont you think that sending a query from VB6 to Access would be a better way instead of modifying the queries in Access.
Hope I understood your question correctly.

Export SQL code from Excel into SQL

My skill level: basic user of VBA, know next to nothing about SQL (though I’ve recently learned how to execute code, etc).
I’ve created a user interface in an Excel worksheet to allow user input of report variables (dates, etc). These pass into a second Excel worksheet that, through the use of various Excel statements, creates the necessary SQL code. My macro then copies this worksheet and opens Microsoft SQL Server 2008 Rx via a shell command. Currently, I then manually click “connect” on the resultant Microsoft SQL Server 2008 R2 connect-to-server window (which does not need a password, just requires me to click “connect”), I create a new query, I paste the code in and then execute in SQL. So it is these latter steps (opening SQL, click “connect”, copy/paste code, execute) that I’m trying to automate via VBA.
To offer more context, once the SQL code has run, I then have a second macro that uses the Excel Data Connection wizard to bring the resultant SQL data back into my worksheet. This is working well.
I’ve researched this for several days on various boards. None seem to observe my approach of creating the code in Excel (probably because it is an inelegant approach). Or the post responses are beyond my skill level to understand. But I do fear that I’m asking a question that has been answered before (apologies in advance).
Thanks for whatever advice/time can be offered.
I’m using:
Excel/Office 2010
Microsoft SQL Server2008 R2 (is this the same as Microsoft SQL Server Management Studios? My SQL application shows both names)
Microsoft ActiveX Data Objects 6.1 Library (this is NOT currently checked off. One post I saw referenced the need for this. I have multiple prior AciveX Library versions available as well.)
What you're doing is very ingenious, but it's probably not necessary. Excel has a number of features for importing external data.
I would look at the Data tab in Excel and the From Other Sources section of the ribbon. You have at least three options: the From SQL Server, From Data Connection Wizard, and From Microsoft Query options.
All of these will set up a connection to a database server and execute SQL against it. They return data to your spreadsheet in different ways.
Where VBA will come into play again is in automating the generation and parameterization of the queries these will execute.
But I would set up something that works, with constants for your parameter values, first, so you get an idea of the possibilities, and then read and research dynamically setting your SQL with VBA.
You might also investigate PowerPivot, by the way.

Reporting Services: Exported to Excel results are different than the ones viewed on IE

I'm having this problem:
The SQL Server holds a said value, let's say 990.30, the Reporting Services Report show a different value (948.33) when viewed online, in the brower and a third value (912.22) when the report is exported to Excel.
There are no formulas on Excel, just plain values.
Also, there's no formula on the layout of the report.
The code shows only a simple select that, when run on the SQL Server Management Studio, returns me the original value (990.30).
How on earth shall I start to troubleshoot this ?
I've never heard of this kind of problem before. I would recommend submitting a ticket to Microsoft and provide them with screen shots of the errors, the RDL file, a sample output of the stored procedure, etc.
To troubleshoot this on your own, I would recommend creating a new report that just has a simple table that returns all the details from your stored procedure or query to validate the values are consisten across all interfaces. From there, just start adding on complexity until you get the report to look like it is today.

SQL query and MS Access query returns different data

I use MS Access as a front end to my MS SQL server.
When I use a SQL query in ms Access that is (in my opinion) equivalent to a query I run from the SQL server, Access returns different data. The pictures below illustrate the difference. I use Access 2003 and I have connected the Access table to the SQL server (2008) through ODBC.
Anybody got an idea how to fix this??
Thanks in advance
/Iljitj
The SQL and Access Query and result:
(It's the "Projekt" column that is different)
http://i.imagehost.org/0218/SQL_access_query_and_result.jpg
Okay I solved the problem. Apperently Access won't do anything without a unique identifier. Since I didn't have that in my table, Access used CVRnr as identifier, but since it isn't unique, Access only pulled the first row and dublicated it, hence the "incorrect" data.
I added the unique identifier, and linked it correctly to Access and now it works.
Thanks a lot guys for all your help and suggestions, I don't think I would have ever figured out the cause was the identifier if some of you haven't suggested it.
You saved me ;)
Recreate Access linked table. Sometimes Access internal definitons go bad, especially when there are some changes in linked server data structures, tables/columns are recreated/altered or similar.
BTW, Access itself is certainly not bad, just it is meant for simple desktop 'databasing'. It has many limitations and some quirks, but it is quite usable.
I would just stop using Access. It appears to be very broken. First off let's find out what select statement access is really using.
In SSMS (SQL Server Management Studio) go Tool -> SQL Server Profiler.
Attach to the same database then see what Access is doing. File -> New -> connect -> run.
Ok, I see a couple of things...
Do you have a Primary Key setup for the table on MS SQL? That might be confusing MS Access.
The boolean column do have different values, but I think that's because MS Access likes to represent them differently than the MS SQL. That you're going to have to live with.

SQL behind an external data query in Excel

I have inherited an Excel spreadsheet which contains an external data query. I can edit the query, which provides a list of the columns returned, but it does provide the table that this data comes from. Is there any way to retrieve the actual SQL behind the query?
I think this may depend on the version of office you're using and the type of external data you're connecting to.
I believe if you're using Office 2003, and you're seeing columns like you say, there may be a SQL icon in the toolbar.
Click that to view the SQL used to return the data.
If you're using Office 2007, Go to the Data tab, click connections, then properties, then the definition tab, and change the command text.
However I believe you're using the first method.
This is from what I can remember, so I hope it's correct.
It could also be somewhat obsfuscated by using an ODBC link or something. Another way to get it is to run SQL Profiler on the SQL Server to see the exact SQL being executed. Of course, this won't help you edit it but you'll know what it is doing.