xsd dataset not showing for rdlc report ASP.Net - asp.net

I have created a report file in my ASP application, Statistics.rdlc
I have created a Data Source which connects to my local database.
I now wish to add a Dataset using a specific query I have written, however when I right click Datasets in the Report Data panel and select my Data source I am presented with a list of the tables on the database under 'Available datasets'.
What I am expecting to see here is the Dataset1.xsd I created which contains the following:
That Query contains the SQL I wish to apply to my report table, can any point out what im doing wrong here?

I needed to create a table adapter not a query.
This post helped me out:
http://www.c-sharpcorner.com/UploadFile/a72401/rdlc-report-generation-using-dataset/

Sometimes report view doens't allow when you use "SELECT * FROM". Put all columns instead of *.
Ex: SELECT column1, column2, column3 FROM table

Related

Export Multpile Tables Data as Insert Statements in to single file Oracle DB [duplicate]

The only thing I don't have an automated tool for when working with Oracle is a program that can create INSERT INTO scripts.
I don't desperately need it so I'm not going to spend money on it. I'm just wondering if there is anything out there that can be used to generate INSERT INTO scripts given an existing database without spending lots of money.
I've searched through Oracle with no luck in finding such a feature.
It exists in PL/SQL Developer, but errors for BLOB fields.
Oracle's free SQL Developer will do this:
http://www.oracle.com/technetwork/developer-tools/sql-developer/overview/index.html
You just find your table, right-click on it and choose Export Data->Insert
This will give you a file with your insert statements. You can also export the data in SQL Loader format as well.
You can do that in PL/SQL Developer v10.
1. Click on Table that you want to generate script for.
2. Click Export data.
3. Check if table is selected that you want to export data for.
4. Click on SQL inserts tab.
5. Add where clause if you don't need the whole table.
6. Select file where you will find your SQL script.
7. Click export.
Use a SQL function (I'm the author):
https://github.com/teopost/oracle-scripts/blob/master/fn_gen_inserts.sql
Usage:
select fn_gen_inserts('select * from tablename', 'p_new_owner_name', 'p_new_table_name')
from dual;
where:
p_sql – dynamic query which will be used to export metadata rows
p_new_owner_name – owner name which will be used for generated INSERT
p_new_table_name – table name which will be used for generated INSERT
p_sql in this sample is 'select * from tablename'
You can find original source code here:
http://dbaora.com/oracle-generate-rows-as-insert-statements-from-table-view-using-plsql/
Ashish Kumar's script generates individually usable insert statements instead of a SQL block, but supports fewer datatypes.
I have been searching for a solution for this and found it today. Here is how you can do it.
Open Oracle SQL Developer Query Builder
Run the query
Right click on result set and export
http://i.stack.imgur.com/lJp9P.png
You might execute something like this in the database:
select "insert into targettable(field1, field2, ...) values(" || field1 || ", " || field2 || ... || ");"
from targettable;
Something more sophisticated is here.
If you have an empty table the Export method won't work. As a workaround. I used the Table View of Oracle SQL Developer. and clicked on Columns. Sorted by Nullable so NO was on top. And then selected these non nullable values using shift + select for the range.
This allowed me to do one base insert. So that Export could prepare a proper all columns insert.
If you have to load a lot of data into tables on a regular basis, check out SQL Loader or external tables. Should be much faster than individual Inserts.
You can also use MyGeneration (free tool) to write your own sql generated scripts. There is a "insert into" script for SQL Server included in MyGeneration, which can be easily changed to run under Oracle.

How can i make the users use the same table of the database with a different values?

Please if someone have an idea about what i'm searching about.
i'm develloping an application web with asp.net and sql server. I have used a gridview and i want to make every new user after login see the gridview clear in order to create its own values.
But The gridview must still related with the same table of the database.
I hope that you understand my problem and i'm sorry for my english.
Are the columns in the gird bound to columns of your users table or are they bound to it's own separate table?
If it's the latter, the table for the grid should have a column specifically for the users' id
for example, if the records for the gridview were held in table USER_GRIDVIEW_RECORDS:
ALTER TABLE USER_GRIDVIEW_RECORDS
ADD USER_ID INT NOT NULL;
This way you can set the DataSource of the grid to the result of the following query:
SELECT * FROM USER_GRIDVIEW_RECORDS
WHERE USER_ID = LOGED_IN_USER_ID
And write the records of the gridview back to the database with the following query.
INSERT INTO USER_GRIDVIEW_RECORDS (USER_ID, OTHER_COLUMN_NAMES, MORE_COLUMN_NAMES)
VALUES (LOGED_IN_USER_ID, 'Example value', 'another example')
If this isn't enough for you, give us some example code of how you query your server and about how you write the DataSet to the DataSource of your GridView

Oracle BI Publisher - Dynamic number of columns

I'm creating a report in BI Publisher using the BI Publisher Desktop tool for Word.
What I need is to have a table with a dynamic column number.
Let's imagine I'm listing stocks by store: Each line is an item and I need to have a column for each store in the database, but that must be dynamic because a store can be created or deleted at any moment.
The number of stores, i.e., the number of columns that need to exist is obtained from an SQL query that goes into the report by a data set.
The query will be something like SELECT COUNT(*) AS STORE_COUNT FROM STORE; in a data set named G_1, so the number of columns is the variable G_1::STORE_COUNT.
Is there any way that can be achieved?
I'm developing the report using an .rtf file, so any help related would be appretiated.
Thank you very much.
Create a .rtf file with the column names mapped to a .xdo or .xdm file. The mapped column in .xdo or .xdm file should be in the cursor or the select statement of your stored procedure of function.

How to add new column in SQL Server using SqlBulkCopy which is not present in Excel using asp.net

I am creating an application which will upload data from Excel to SQL Server using ASP.NET. I know how to upload Excel data using SqlBulkCopy. But I am trying to upload some extra data for the table column (addeddate, addedby...etc) which is not present in the Excel sheet.
I get this error:
The given ColumnName '18-01-2016 17:24:07' does not match up with any column in data source.
You can try below solution to insert constant values like addeddate, addedby...etc.
SELECT
EXCEL_COL1,
EXCEL_COL2,
'newconstantvalue' as CustomCol
FROM
ExcelSheet1
Then
bulkCopy.ColumnMappings.Add("Table_COL3", "CustomCol");
Please refer the article for more detail.

Sqlite: Create a table and fill with information only once

I have an appcelerator titanium project (you don't need to be familiar with the platform to help me) that I am using to create an iOS app. I want to have a database with a table that is filled with several rows for the first time, and then left alone after the first time.
I know you can create a table if it doesn't exist. Is there something similar for Inserting data?
Thanks!
Expanding on MPelletier's response with some Titanium-specific code, you could do the following in your project:
var my_db = Ti.Database.open('nameofdb');
var my_result_set = my_db.execute('SELECT * FROM MyTable');
var records = my_result_set.rowCount;
The records variable will indicate whether or not you have data in your table and then you can act accordingly.
There are a couple of nice ORM-ish utilities out there for Titanium: TiStore and Joli are the two I've used. Both are inspired by ActiveRecord and can be helpful in reducing your DB-related code. They're on Github if you want to know more about them!
There's INSERT OR REPLACE if you want, but you might as well just check against the number of rows on the table:
SELECT COUNT(*) FROM MyTable;
Then decide to enter them on that.
You can create your DB and insert data in it via SQLLiteManager or whatever tool you want and then dump it.
Take the file you dumped, put it in your Titanium project folder (somewhere in the Resources folder).
Then this line of code will take the content of the .sqlite file and insert it in the iOS db:
var db = Ti.Database.install('../your-db.sqlite', 'your-db-name');
Just don't forget the CREATE IF NOT EXISTS statement in your SQL file.
Or use REPLACE instead of INSERT as MPelletier said.

Resources