Problem Using Parameter On SQL Source Data Control
May 15, 2006
I have an ASP page which uses an SQL data source control, as shown below:
<asp:SqlDataSource ID="mySQL" runat="server"
ConnectionString="<%$ ConnectionStrings:mySQLConnectionString %>"
SelectCommand="SELECT device FROM device_table WHERE (device_id IN (@devicelist))">
<SelectParameters>
<asp:Parameter DefaultValue="" Name="devicelist" Type="String" />
</SelectParameters>
</asp:SqlDataSource>
The problem is getting the "IN" clause of the select statement to work via the ASP page with code behind in C#. If I test the query in the page designer when configuring the SQL control by inserting 'device-1','device-2','device-3' as the value for the "devicelist" parameter, everything works as expected. However, when that same value is written programmatically into the DefaultValue of the parameter, the resulting query contains no results (as if the string contents are invalid). If I alter my program to supply a single entry (with no commas) it seems to work as well. I suspect the comma (and possibly the single-quote) characters in my string when multiple entries are involved are causing the issue.
Is there a proper technique for getting the requisite quote-delimited, comma-separated list into the SQL control command parameter correctly? Should I be using some sort of escape sequence for the single-quote and comma characters? Should I be using another "type" for the parameter; one that accepts an array of entries? I have not been able to find any examples or documentation that provides an answer.
View 1 Replies
ADVERTISEMENT
Nov 7, 2006
Hello,
I am using this sql data source control.
<asp:textbox runat="server" id="txtFromDate" ReadOnly="true"></></asp:textbox>
<asp:textbox runat="server" id="txtToDate" ReadOnly="true"></asp:textbox>
--------------------------------->
<asp:sqldatasource id="dsClickInfo" runat="server" connectionstring="<%$ ConnectionStrings:activeConnectionString %>"
selectcommand="SProc_GetTransaction" selectcommandtype="StoredProcedure">
<SelectParameters>
<asp:QueryStringParameter QueryStringField="Id" Name="MerchantID" Type="int32" />
<asp:ControlParameter ControlID="txtFromDate" Name="StartDate" PropertyName="Text"
Type="String" DefaultValue="0" />
<asp:ControlParameter ControlID="txtToDate" Name="EndDate" PropertyName="Text"
Type="String" DefaultValue="0" />
</SelectParameters>
</asp:sqldatasource>
I abouve code txtFromDate and txtToDate are marked as readonly so sqldatasource is not able to get value from these controls.
How is it possible?
Please help me..
View 3 Replies
View Related
Jan 24, 2008
I have a DB with the folloing fields... ArticleID, ArticleTitle, PublishDate(DateTime Field), EndPublishDate(DateTime Field).... What I want to do is show in a list view only the articles where the date is on or after the PublishDate and before or on the EndPubishDate.
I thought I could simply do something like this
SELECT ArticleTitle, PublishDate, PublishEndDate, PublishedFROM UserArticlesWHERE (Published = @Published) AND (PublishDate >= @PublishDate) AND (PublishEndDate <= @PublishEndDate)
Well I can't... can someone explain how I can do this please... I understand the the PublishDate and EndPublsihDate need a variable... The info is in the DB I just don't know how to do what I need to.
Thanks,
View 4 Replies
View Related
Apr 23, 2008
I have an SQL data source on my page and I select "Table". On the next screen I pick the fields I want to show. Then I click the "Advanced" button because I want to allow Inserts, updates and deletes. But its all greyed out abd I can't check this option. The UID in the connection string I am connecting under has the correct permissions in SQL server to do inserts, update and deletes too. Anyone know why it would be greyed out? The connectionstring property in the aspx code is dynamic but this shouldn't be the reason because I have used this before with success
View 2 Replies
View Related
Jul 8, 2015
I have two data tables:
1) Production data with column headers: Key, Facility, Line, Time, Output
2) Costs data with column headers: Key, Site, Cost Center, Time, Cost
The tables have a common key named obviously as Key. The data looks like this:
Key
Facility
Line
Time
Output
Alpha
I would like to have two pivot tables which I can filter with ONE slicer based on the column Key. The first pivot table shows row labels Facility, Line and column labels Time. Value field is Output. The second pivot table shows row labels Site, Cost Center, and column lables Time. Value field is Cost.How can I do this with Power Pivot? I tried by linking both tables above to a table with unique Keys in PowerPivot and then creating a PivotTable where I would have used the Key from the Keys table.
View 5 Replies
View Related
Feb 29, 2008
Each day I receive a file with a different name. For example, the name is filename_mmddyyyy.txt where filename_ stays constant and mmddyyyy is the date of the file. The file is always in the same format.
I want to build an SSIS where I pass it this file name. I can write a script to generate the correct file name. How do I build the SSIS so it can accept the input parameter and find the correct file to process?
Thanks
View 3 Replies
View Related
May 3, 2007
In SSIS in Sql task we have option to pass parameter or variable..But in Data Flow Task when we use Data Reader Source using ADO.NET connection..There is no option to pass parameter or variable Or no option to receive a parameter or variable .
I am having a query were it need to pass a parameter.in sql task ...And Data Reader Source have to receive this parameter from sql task .
Sql Task finds a value of parameter and pass to DataReader Source in DataFlow Task .. ...
Please can any one help me to solve this problem of Receiving parameter or variable in DataReader Source using DAO.Net connection in DataFlow Task..thank you dilsa
View 3 Replies
View Related
Feb 14, 2006
Hi, All,
I need to pass a parameter from control flow to data flow. The data flow will use this parameter to get data from a Oracle source.
I have an Execute SQL task in control flow to assign value to the Parameter, next step is a data flow which will need take a parameter in the SQL statement to query the Oracle source,
The SQL Looks like this:
select * from ccst_acctsys_account
where to_char(LAST_MODIFIED_DATE, 'YYYYMMDD') >?
THe problem is the OLE DB source Edit doesn€™t have anything for mapping parameter.
Thanks in Advance
View 2 Replies
View Related
May 28, 2007
hi gurus,
I am working on creating a new project in asp.net and was having problem in locating the sqldatasource and gridview control objects in the data toolbox.
Can anybody help me in adding these controls to the toolbox?
OS=Windows XP
Server =Sql Server 2005
Visual studio 2003
View 1 Replies
View Related
Jun 11, 2008
Hi,
I noticed the other day the option to use source control in SQL Server management studio. My question is how do I add sln to existing databases in order to add them to source control??
Thanks.
View 1 Replies
View Related
Feb 15, 2007
Hi all,
I'm in need of a source control system that integrates with the Management Studio so that every time i want to modify a table, view, procedure etc I have to check it out from the object explorer and then check it back in again. I have used Visual Source Safe before but never with a database...is it fully integrated with SSMS? What can I do to make this work as smoothly as possible?
Is there any other IDE that handles this better than SSMS?
--
Lumbago
"Real programmers don't document, if it was hard to write it should be hard to understand"
View 3 Replies
View Related
Oct 5, 2007
Why can't another developer check out SSIS packages from source control in TFS. I have given the developer all the permissions out there. I was the one who had created an SSIS solution/project local on my machine and then added to source control in TFS under the teamproject. The developer can do everything except in the source control explorer, everything is grayed out. I know you can set up permissions in source control explorer, and I have done that. but still no luck. Can it be related to workspace. When I open the Souce control explorer, in the workspace, I see the name of my local machine. should it be different. or is something else an issue.
Please advice.
Thank you.
View 1 Replies
View Related
Jan 15, 2008
I was having one package which uses a source query in OLEDB Source Control and fetches the record and a couple of lookups and then an oledb command to insert/update the records in the table using as SP. I changed the source query(Infact the package) and removed in lookup and a different SP was called similar to the old one. But my problem is the package which was before taking only minutes to update 50,000 records is now taking more than 2 hrs. The problem is the number of records it is fetching from the source each time is very less.. its fetching hardly 500 records a time compared to nearly 2500 records before. Where am i going wrong? Any suggestion greatly appreciated.
View 5 Replies
View Related
Apr 17, 2005
Hi guys'n'girls...
I currently work for a company where we develop several large ASP.NET applications which are VERY data centric. But lately we have run into a problem on our developer DB...
On the project I am working on we currenctly have approx. 10 developers working concurrently on the database. That means that we often run into errors caused by two developers working on the same stored procedure, function or trigger so the developer who adds his changes last, overwrites the modifications done by the other developer. The obvious answer is source control for the db, but as far as I can tell this is only available for stored procedures and not for functions or triggers... And even the stored procedure solution isn't very safe because it only works if every developer is editing the procedures through VS.
So what do we do? There must be some solution to this problem... And I'm pretty convinced that we are not the first company to face this problem. Are we doing it the wrong way or do you know another solution?
Thanks in advance!
View 1 Replies
View Related
Oct 18, 2005
We have a large team working on applications to support our internal sales and our public dotcom site. In the process, as you can imagine, we generate a lot of stored procedures and sql scripts going to our dba's for our staging,qa and production environments- but we don't have a solid way to manage it yet. Some people use Source Safe? Does anyone have any successes in this area or recomendations?Thanks!s!Stephen Rylander
View 2 Replies
View Related
Sep 7, 2000
Hi,
We use a lot of stored procedures within our project and I am looking for a source code/versioning control software that can be used with SQL Server 7.0 to track any changes to these stored procedures. Does anyone have any suggestions?
Thanks in advance,
Darrin Wilkinson
View 2 Replies
View Related
Nov 22, 2005
Hi!
I have a strored proc which adds up fields separated by semicolon into a new one and I'd like to use it as a combo box's control source field as a Value list. But it's just insert the whole field into one line like value1;value2;value3 .
Is there any way to get these values selectable in the combo box?
Thanks in advance for any help.
Vill
View 1 Replies
View Related
Jan 5, 2004
I noticed from this link:
http://www.aspfaq.com/show.asp?id=2495
There are four well known products that are used by medium to large size shops to help aid in change management of SQL Environments.
- AbaPerls
- DBGhost
- MSSqlExpress
- SQL Source Control
Does anyone currently use any of the above? Could you briefly explain your likes an dislikes and if you have reviewed any of the other options above when you had to make a decision as to which product to use?
View 2 Replies
View Related
Jan 25, 2007
Hello SQL Server Community.
I'm looking for a way to keep my database in Subversion so I can maintain it in source control.
Seems like the best way to do this would be to dump the database to a text script file. This works fine for creating the database structure and managing those change, however, that database structure is useless without the actual data in the tables.
Is there a good way to generate the inserts for the actual data? Why isn't this an option in the script wizard.
Also, does anyone have a better idea of source control of SQL Server databases in Subversion?
Thanks,
Ryan.
http://www.dynamicajax.com
View 8 Replies
View Related
Jan 3, 2008
Look for recommendations for the best product out there to facilitate both source control and code deployment. Typical features I would be looking for are bullet below:
Control object versions
Tracking
History
Automated feature
Capture database changes
Roll-back feature (should such a thing exist)
Thanks
View 2 Replies
View Related
Jul 20, 2005
Hi,I am trying to put SQL Server Stored Procedures into Sourcesafe as perthe Microsoft Knowledge Base article 818368, but have run into aproblem.The web server is SQL Server 2000 running on Windows 2003 Server. Theclient dev environment is Visual Studio 2003 Enterprise DeveloperEdition.I have carried out the following steps successfully:-1. Installed Sourcesafe client tools on the Server (sourcesafe is onanother server)2. Run the MSSQLServer service under a domain account that has Readand Write access to the Sourcesafe database.3. Added the above user to Sourcesafe using the Administrator tool.4. Installed the VS6 Stored Procedure Version Control components onthe Server5. Enabled Version Control for Stored Procedures on the clientHowever when I right-click on the Stored Proc node in Server explorerI do not get any of the Sourcesafe menu options. They are not greyedout, they are simply not there!Any help would be appreciated.Alternatively if anyone has recommendations for other strategies orother tools to use for this purpose than Sourcesafe then this wouldalso be welcomeKarl
View 1 Replies
View Related
Aug 26, 2007
Our team has the following problem:
I create a SSIS project in VS and add it to Team Source Control. When the project and all it's files exist on a machine and I want to open the project from Source Control, everithing works fine, but when another developer, who doesn't have the files on his machine, wants to open the project from Source Control he is required to check out the project file.
I've investigated the problem and found out that each project has a database file (with .database extension) and project file contains a reference to it. Once the user opens from Team Source Control a project that isn't presented on a target machine, the VS creates a new database file on a local machine and insists to change the reference in the project file.
Does anyone have a workaround for the problem?
Thanks
View 5 Replies
View Related
Aug 30, 2007
Hi
We have encountered a problem using source control with reporting services. Im writing this post to find out whether we are doing something wrong, or reporting service just don't store everything in source control.
My problem is as follows.
My collegue creates a report with a dataset and this report contains several parameters. He tests this, deploys it, and checks it into the source control through Visual Studio.
The following day I get responsibility to alter something in this report. I checks out everything from source control, starts Visual Studio. But... A few important things are missing. The credentials for the dataset for once (this is a minor issue) since these might not should be stored in source control anyways. What is worse is that all the parameter settings are missing. What was entered was a query to a stored procedure where e.g 5 parameters in the report was mapped to parameters in the stored procedure. Now the query has been changed to text type, and the parameter mapping is missing.
This does make it impossible to cooperate on creating reports. If I now make a change in the parameter configuration, my collegue won't receive this when synchronizing source control, and the risk of deploying something incorrect is too high.
Can anyone help enlighten us. Are we doing something wrong? Is there some manual step that needs to be done to ensure that everything is stored in source control? Or is it just something we have to live with, not being able to trust source control when doing Reporting Services?
Best regards
/Anders
View 1 Replies
View Related
Apr 22, 2007
I have all the config files for my various packages in a folder call configs. It seems that I cannot add folders to the SSIS solution. I can add config files, but they get copied into the root folder, which breaks the directory structure that I have.
Am I missing something? Is there a recommended to manage config files, and other external files used by the SSIS package, in SourceSafe and in the SSIS solution? Thank you.
View 1 Replies
View Related
Apr 18, 2006
Hi,
I was wondering if anybody could advise on source code control for SQL Server express, for the table schema and stored procedures?
I currently use Sourcesafe V6 to work with visual studio 6 and 2003 (although it isn't integrated in 2003), and wondered if that can be used?
Any suggestions would be greatly appreciated, as I see this as a disaster waiting to happen!
Thanks in advance.
Mark
View 4 Replies
View Related
Mar 13, 2008
hi ,
i am trying for a drill through report (rdlc)
ihave written the following code in drill through event of reportviewer, whenever i click on the first report iam getting the error like
An error has occurred during report processing.
A data source instance has no
t been supplied for the data source "DetailDS_get_orderdetail".
the code is
using System;
using System.Data;
using System.Data.SqlClient;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
//using Microsoft.ApplicationBlocks.Data;
using Microsoft.Reporting.WebForms;
using DAC;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
ReportViewer1.Visible = false;
}
protected void Button1_Click(object sender, EventArgs e)
{
DAC.clsReportsWoman obj = new clsReportsWoman();
DataSet ds = new DataSet();
ds = obj.get_order();
ReportViewer1.LocalReport.DataSources.Clear();
ReportDataSource reds = new ReportDataSource("DataSet1_get_order", ds.Tables[0]);
ReportViewer1.LocalReport.DataSources.Add(reds);
ReportViewer1.LocalReport.ReportPath = "C:/Documents and Settings/km63096/My Documents/Visual Studio 2005/WebSites/drillthrurep/Report.rdlc";
ReportViewer1.LocalReport.Refresh();
ReportViewer1.Visible = true;
}
protected void ReportViewer1_Drillthrough(object sender, DrillthroughEventArgs e)
{
DAC.clsReportsWoman obj = new clsReportsWoman();
ReportParameterInfoCollection DrillThroughValues =
e.Report.GetParameters();
foreach (ReportParameterInfo d in DrillThroughValues)
{
Label1.Text = d.Values[0].ToString().Trim();
}
LocalReport localreport = (LocalReport)e.Report;
string order_id = Label1.Text;
DataSet ds = new DataSet();
ds = obj.get_orderdetail(order_id);
ReportViewer1.LocalReport.DataSources.Clear();
ReportDataSource reds = new ReportDataSource("DetailDS_get_orderdetail", ds.Tables[0]);
ReportViewer1.LocalReport.DataSources.Add(reds);
ReportViewer1.LocalReport.ReportPath = Server.MapPath(@"Reportlevel1.rdlc");
ReportViewer1.LocalReport.Refresh();
}
}
the code in method get_orderdetail(order_id) is
public DataSet get_orderdetail(string order_id)
{
SqlCommand cmd = new SqlCommand();
DataSet ds = new DataSet();
cmd.Parameters.Add("@order_id", SqlDbType.VarChar, 50);
cmd.Parameters["@order_id"].Value = order_id;
ds = SQLHelper.ExecuteAdapter(cmd, CommandType.StoredProcedure, "dbo.get_orderdetail");
return (ds);
}pls help me.
View 1 Replies
View Related
May 4, 2006
I'm writing a page to do some reporting off of one of our databases, and I'm using 3 control parameters for my sql query that feeds my datagrid. 2 of the ControlParameters are from dropdownlists, and one is from a RadioButtonList. The ControlParameters that reference the dropdownlists are both working well, but the one for the RadioButtonList is not.
The error I am getting is: Exception Details: System.Data.SqlClient.SqlException: Line 1: Incorrect syntax near '@Booga'. (I changed my ControlParameter name from DateStr to Booga to try to avoid any conflicts with reserved words.)Any ideas? Here is a snippet of my code:
<form id="form1" runat="server">
<table width="100%">
<tr>
<td style="text-align: center">
<strong>DataCenter</strong></td>
<td style="text-align: center">
<strong>Time Scope</strong></td>
<td style="text-align: center">
<strong>Call Status</strong></td>
</tr>
<tr>
<td style="height: 47px; text-align: center">
<asp:DropDownList ID="DropDownList1" DataSourceID="SqlDataSource2" AutoPostBack="true" DataTextField="LocationName" runat="server" />
</td>
<td style="height: 47px; text-align: center">
<asp:RadioButtonList ID="RadioButtonList1" runat="server" AutoPostBack="true" Font-Size="Smaller">
<asp:ListItem Selected="True" Value=" 1 = 1 ">All</asp:ListItem>
<asp:ListItem Value="((CAST(CallLog.RecvdDate AS smalldatetime) + 1) >= (CAST(GETDATE() AS smalldatetime)))">Last Day</asp:ListItem>
<asp:ListItem Value="((CAST(CallLog.RecvdDate AS smalldatetime) + 7) >= (CAST(GETDATE() AS smalldatetime)))">Last Week</asp:ListItem>
<asp:ListItem Value="((CAST(CallLog.RecvdDate AS smalldatetime) + 30) >= (CAST(GETDATE() AS smalldatetime)))">Last 30 Days</asp:ListItem>
<asp:ListItem Value="((CAST(CallLog.RecvdDate AS smalldatetime) + 120) >= (CAST(GETDATE() AS smalldatetime)))">Last 120 Days</asp:ListItem>
</asp:RadioButtonList></td>
<td style="height: 47px; text-align: center">
<asp:DropDownList ID="DropDownList2" AutoPostBack="true" runat="server">
<asp:ListItem Selected="True" Value="Open">Open</asp:ListItem>
<asp:ListItem Value="Closed">Closed</asp:ListItem>
</asp:DropDownList></td>
</tr>
</table>
<br />
<p style="text-align: center"><strong>Displaying All Open Tickets</strong><br /></p>
<asp:SqlDataSource ID="SqlDataSource2" runat="server" SelectCommand="SELECT DISTINCT [locationname] FROM [profile]"
ConnectionString="<%$ ConnectionStrings:Heat %>" />
<table width="100%">
<tr width="100%">
<td valign="top" width="100%">
<asp:GridView ID="GridView1" AllowSorting="True" runat="server"
DataSourceID="SqlDataSource1" DataKeyNames="CallID"
AutoGenerateColumns="False" Font-Size="Smaller" Width="100%" >
<Columns>
<asp:CommandField />
<asp:BoundField DataField="CallID" HeaderText="Call ID" ReadOnly="True" SortExpression="CallID" />
<asp:BoundField DataField="CustID" HeaderText="Customer ID" ReadOnly="True" SortExpression="CustID" />
<asp:BoundField DataField="CallType" HeaderText="Call Type" ReadOnly="True" SortExpression="CallType" />
<asp:BoundField DataField="Priority" HeaderText="Priority" ReadOnly="True" SortExpression="Priority" />
<asp:BoundField DataField="Cause" HeaderText="Cause" ReadOnly="True" SortExpression="Cause" />
<asp:BoundField DataField="CallDesc" HeaderText="Call Description" ReadOnly="True" SortExpression="CallDesc" >
<ItemStyle Width=40% />
</asp:BoundField>
<asp:BoundField DataField="RecvdBy" HeaderText="Received By" ReadOnly="True" SortExpression="RecvdBy" />
<asp:BoundField DataField="RecvdDate" HeaderText="Call Date" ReadOnly="True" SortExpression="RecvdDate" >
<ItemStyle Wrap="False" />
</asp:BoundField>
<asp:BoundField DataField="RecvdTime" HeaderText="Call Time" ReadOnly="True" SortExpression="RecvdTime" >
<ItemStyle Wrap="False" />
</asp:BoundField>
</Columns>
</asp:GridView>
<asp:SqlDataSource ID="SqlDataSource1" runat="server" SelectCommand="SELECT * FROM CallLog INNER JOIN Profile ON CallLog.CustID = Profile.CustID WHERE (Profile.LocationName = @LocationName) AND (CallLog.CallStatus = @CallStatus) AND @Booga "
ConnectionString="<%$ ConnectionStrings:Heat %>">
<SelectParameters>
<asp:ControlParameter ControlID="DropDownList1" Name="LocationName" PropertyName="SelectedValue" Type="String" />
<asp:ControlParameter ControlID="DropDownList2" Name="CallStatus" PropertyName="SelectedValue" Type="String" />
<asp:ControlParameter ControlID="RadioButtonList1" Name="Booga" PropertyName="SelectedValue" Type="String" />
</SelectParameters>
</asp:SqlDataSource>
</td>
</tr>
</table>
<br />
<br />
<br />
<br />
</form>
View 2 Replies
View Related
Jun 11, 2015
How to integrate current artifacts with TFS ?
For example : We have multiple applications X, Y, Z  each has  its own SSIS solution , SQL Script, MSTR report and documentation.
We move code from Dev to Test and then to PROD
How to structure the folders which will be easy to manage and easy to release ?
View 3 Replies
View Related
Mar 18, 2008
I have a query that returns multiple values for a dataset called dsLastWeekOfPeriod. The query returns to me the last week of every period for this fiscal year. I have a parameter called LastWeekOfPeriod, and it is multi valued.
In my report, I want a border for every row in the matrix's dataset where the fiscal week of year matches one of the values in the parameter LastWeekOfPeriod.
I've tried a few different lines of code in the BorderStyle section of the Properties of the row in the matrix, but the border is not appearing. Could somebody help me with the code? Thanks.
=IIF(Fields!FiscalWeekOfYear.Value = Parameters!LastWeekOfPeriod.IsMultiValue,"SOLID", "NONE")
View 1 Replies
View Related
May 13, 2007
I have created an ASP.NET website with a ReportViewer on. The report renders fine, but when I change one of the parameters (manually), the report seems to invalidate itself and a blank while area is drawn. I would like the same behaviour as in the WinForms variant, where rhe rendered report remains the same until the 'View Report' button is pressed.
Is this possible?
Regards Andreas
View 1 Replies
View Related
May 4, 2007
I'm creating a report with a Datetime parameter. There's no available values, so the calendar control comes out automatically when I run/preview the report. Now, when I select the date in my calendar control, say for example I select 2/5/07 (2nd of May) and run the report, it gives me data from 5th of Feb. Can anyone help me with this date format problem ???
Not sure if it's related to my problem, I did edit the language tag in the XML source code of my report to have en-AU so that the dates field is showing in the correct dd/mm/yyyy format.
View 2 Replies
View Related
Jan 10, 2006
How would I hide certain parameter controls based on user sections in certain controls dynamically at runtime. I am using RS 2003 edition.
View 5 Replies
View Related
Feb 2, 2008
,
Hi
In this code how can I create a new data source and new data source view and model and structure that it run dynamic.
In this code I have a lot of errors, that they are about server and database don€™t have in current code,
In this code, first I should definition server or no?
Database dbNew = new Database (databaseName,
Utils.GetSyntacticallyValidID(databaseName, typeof(Database)));
srv.Databases.Add(dbNew);
dbNew.Update(true);
***********************************************************
How can I create data source and data source view and model and structure?
Please say code of that, and guide me.
databasename and srv is unknown.
Do I add other reference with analysis services?
Please explain about these codes:
************************************************************************
1)
RelationalDataSource dsNew = new RelationalDataSource(
datasourceName,
Utils.GetSyntacticallyValidID(
datasourceName,
typeof(RelationalDataSource)));
db.DataSources.Add(dsNew);
dsNew.ConnectionString = connectionString;
dsNew.Update();
2)
RelationalDataSourceView rdsv;
rdsv = db.DataSourceViews.Add(
datasourceviewName,
Utils.GetSyntacticallyValidID(
datasourceviewName,
typeof(RelationalDataSourceView)));
rdsv.DataSourceID = ds.ID
***************************************************************
3)
OleDbConnection cn = new OleDbConnection(ds.ConnectionString);
OleDbCommand cmd = new OleDbCommand(
"SELECT * FROM [" + tableName + "] WHERE 0=1", cn);
OleDbDataAdapter ad = new OleDbDataAdapter(cmd);
DataSet dss = new DataSet();
ad.FillSchema(dss, SchemaType.Source);
*************************************************************
4)
// Make sure we have the name we thought
dss.Tables[0].TableName = tableName;
// Clone here - the original DataTable already belongs to a DataSet
rdsv.Schema.Tables.Add(dss.Tables[tableName].Clone());
rdsv.Update();
5)
MiningStructure ms = db.MiningStructures.Add(miningstructureName, Utils.GetSyntacticallyValidID(miningstructureName,
typeof(MiningStructure)));
ms.Source = new DataSourceViewBinding(dsv.ID);
ms.CaseTableName = "Customer";
Add columns:
ScalarMiningStructureColumn smsc;
// From table "Customer" we will add a couple of columns
// CustomerID - key
smsc = new ScalarMiningStructureColumn("Customer ID",
Utils.GetSyntacticallyValidID("Customer ID", typeof(ScalarMiningStructureColumn)));
smsc.IsKey = true;
smsc.Content = "Key";
smsc.KeyColumns.Add("Customer", "customer_id", OleDbType.Integer);
ms.Columns.Add(smsc);
*******************************************
6)
MiningModel mm = ms.MiningModels.Add(miningmodelName,
Utils.GetSyntacticallyValidID(miningmodelName,
typeof(MiningModel)));
mm.Algorithm = "Microsoft_Decision_Trees";
mm.Parameters.Add("COMPLEXITY_PENALTY", 0.3);
MiningModelColumn mc = new MiningModelColumn("Customer ID",
Utils.GetSyntacticallyValidID("CustomerID",
typeof(MiningModelColumn)));
mc.SourceColumnID = ms.Columns["Customer ID"].ID;
mc.Usage = "Key";
mm.Columns.Add(mc);
mm.Update();
Please exactly say, whatever I want
Thanks a lot for your answer
Please don€™t move this question because I don€™t know where I should write this.
View 1 Replies
View Related