Showing posts with label return. Show all posts
Showing posts with label return. Show all posts

Tuesday, March 27, 2012

Access DB via SqlDataSource....need result in DataSet

Hi all...I've set the DataSourceMode = SqlDataSourceMode.DataSet, and did a .Type return and found that it is actually returning a DataView. A component I am trying to avoid rewriting...requires a dataset that loops through the table, does some cool formatting to a datagrid and then rebinds.

Here's the code that I'm trying to send the dataset to...maybe there's just a couple of changes that could make it work with a DataView?

int i = 0;
string prevsub = "";
while (i <= ds.Tables[0].Rows.Count - 1)
{
DataRow dr = ds.Tables[0].Rows[i];
string sub = dr["SubHeading"].ToString();
if (sub != prevsub)
{
prevsub = sub;
DataRow newrow = ds.Tables[0].NewRow();
newrow["Title"] = "SubHeading";
newrow[columnName] = dr[columnName];
ds.Tables[0].Rows.InsertAt(newrow, i);
i++;
}
i++;
}

DataView is very close to the dataset object in this context.

my test code:

DataView dv = (DataView) SqlDataSource1.Select(DataSourceSelectArguments.Empty);


int i = 0;
string prevsub = "";
while (i <= dv.Table.Rows.Count - 1)
{
DataRow dr = dv.Table.Rows[i];
string sub = dr["mycol1"].ToString();
if (sub != prevsub)
{
prevsub = sub;
DataRow newrow = dv.Table.NewRow();
newrow["mycol1"] = "SubHeading";
newrow["mycol2"] = dr["mycol2"];
dv.Table.Rows.InsertAt(newrow, i);
i++;
}
i++;
}

Hope this helps.

|||Hi there. Thanks so much limno! That did the trick. I was hoping that the dv would be similar enough to be able to use this code. Great to know and use for the future. Much appreciated!

Sunday, March 25, 2012

Access Cube Detailed Info

Hello,

Could I write ActiveX Script in a DTS Package to return cube info (such as CubeName, CubeStatus, CubeSize, CubePartitions, CubeLastProcessed)? If that's
possible, I could then pump in the result into text file and import them into
a table for reporting purposes.

Please let me know if this is the best route to explore DSO objects or any alternative way of extracting this type of Cube data.

-Lawrence

Oops... this is a duplicate post due to network error. If you could respond to the previous posting, I would really appreciate it!

-Lawrence

Sunday, February 19, 2012

about processXMLdata sample,how to insert a return in end of each row data of the result text fi

I am newbie, having a job to handle some XML files into sql server 2005. In the procXMLdata sample,,pls tell me how to insert a return in end of each row data of the result text file?

I am not familiar with this sample, but my guess is that you need to use Ragged Right Flat File format and choose {CR}{LF} as the row delimiter.

Give us more of the problem's context, if this is not what you are looking for.

Thanks.

|||

hi,

Thanks for your reply.

The processXMLdata sample was put in the sample directory of ms sql server,which just converted a xml file into a txt file ,using two xml task. The first was to preform XPATH method,output a variable, and the second xml task was to do XSLT method ,input the variable above, output a txt.

I know XML little , i guess the problem may be on propery of the second XML task.

Thursday, February 16, 2012

about MSSQLSERVER run as LocalSystem

Hi,it is fail when I try to open a namedpipe of another machine in sql2000's
extern storage procedure.
WNetAddConnection2() return 1312
CreateFile() return -1 and GetLastError() return 5
MSSQLSERVER is running as LocalSystem.
If MSSQLSERVER login using a user account, the extern storage procedure can
open the namedpipe of another machine.
Why? someone can give me a little explanation.
Thanks
RateIf you need a SQL Server to be able to access other network
resources, including other servers, SQL Server needs to be
running under a domain account. Local System doesn't have
access to network resources.
-Sue
On Tue, 14 Mar 2006 10:39:16 +0800, "rate"
<spring_pb@.21cn.com> wrote:

>Hi,it is fail when I try to open a namedpipe of another machine in sql2000'
s
>extern storage procedure.
>WNetAddConnection2() return 1312
>CreateFile() return -1 and GetLastError() return 5
>MSSQLSERVER is running as LocalSystem.
>If MSSQLSERVER login using a user account, the extern storage procedure can
>open the namedpipe of another machine.
>Why? someone can give me a little explanation.
>Thanks
>Rate
>

about MSSQLSERVER run as LocalSystem

Hi,it is fail when I try to open a namedpipe of another machine in sql2000's
extern storage procedure.
WNetAddConnection2() return 1312
CreateFile() return -1 and GetLastError() return 5
MSSQLSERVER is running as LocalSystem.
If MSSQLSERVER login using a user account, the extern storage procedure can
open the namedpipe of another machine.
Why? someone can give me a little explanation.
Thanks
Ratehi,
localsystem account doesn't have network priviledges. this is a security
feature.
Peter.
"rate" <spring_pb@.21cn.com> wrote in message
news:O%23a2VHxRGHA.2536@.tk2msftngp13.phx.gbl...
> Hi,it is fail when I try to open a namedpipe of another machine in
> sql2000's
> extern storage procedure.
> WNetAddConnection2() return 1312
> CreateFile() return -1 and GetLastError() return 5
> MSSQLSERVER is running as LocalSystem.
> If MSSQLSERVER login using a user account, the extern storage procedure
> can
> open the namedpipe of another machine.
> Why? someone can give me a little explanation.
> Thanks
> Rate
>
>

Thursday, February 9, 2012

About Check Constraint

Dear all,
I know Check Constraint can help stop some unwanted data pattern insert into
the field.
It can also return a system message about this.
How can I modify the check constraint return system message to a more user
friendly message in SQL Server?
IvanOn 14 Jun, 05:33, "Ivan" <i...@.microsoft.com> wrote:
> Dear all,
> I know Check Constraint can help stop some unwanted data pattern insert into
> the field.
> It can also return a system message about this.
> How can I modify the check constraint return system message to a more user
> friendly message in SQL Server?
> Ivan
Use a TRY / CATCH block in your procedure to catch the error and
handle it accordingly.
--
David Portas, SQL Server MVP
Whenever possible please post enough code to reproduce your problem.
Including CREATE TABLE and INSERT statements usually helps.
State what version of SQL Server you are using and specify the content
of any error messages.
SQL Server Books Online:
http://msdn2.microsoft.com/library/ms130214(en-US,SQL.90).aspx
--|||Are TRY & CATCH SQL command?
Ivan
"David Portas" <REMOVE_BEFORE_REPLYING_dportas@.acm.org>
'?:1181802475.387039.108510@.d30g2000prg.googlegroups.com...
> On 14 Jun, 05:33, "Ivan" <i...@.microsoft.com> wrote:
>> Dear all,
>> I know Check Constraint can help stop some unwanted data pattern insert
>> into
>> the field.
>> It can also return a system message about this.
>> How can I modify the check constraint return system message to a more
>> user
>> friendly message in SQL Server?
>> Ivan
> Use a TRY / CATCH block in your procedure to catch the error and
> handle it accordingly.
> --
> David Portas, SQL Server MVP
> Whenever possible please post enough code to reproduce your problem.
> Including CREATE TABLE and INSERT statements usually helps.
> State what version of SQL Server you are using and specify the content
> of any error messages.
> SQL Server Books Online:
> http://msdn2.microsoft.com/library/ms130214(en-US,SQL.90).aspx
> --
>|||> Are TRY & CATCH SQL command?
Yes, introduced in SQL Server 2005.
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://sqlblog.com/blogs/tibor_karaszi
"Ivan" <ivan@.microsoft.com> wrote in message news:eq1CIi7rHHA.1848@.TK2MSFTNGP03.phx.gbl...
> Are TRY & CATCH SQL command?
> Ivan
> "David Portas" <REMOVE_BEFORE_REPLYING_dportas@.acm.org>
> '?:1181802475.387039.108510@.d30g2000prg.googlegroups.com...
>> On 14 Jun, 05:33, "Ivan" <i...@.microsoft.com> wrote:
>> Dear all,
>> I know Check Constraint can help stop some unwanted data pattern insert
>> into
>> the field.
>> It can also return a system message about this.
>> How can I modify the check constraint return system message to a more
>> user
>> friendly message in SQL Server?
>> Ivan
>> Use a TRY / CATCH block in your procedure to catch the error and
>> handle it accordingly.
>> --
>> David Portas, SQL Server MVP
>> Whenever possible please post enough code to reproduce your problem.
>> Including CREATE TABLE and INSERT statements usually helps.
>> State what version of SQL Server you are using and specify the content
>> of any error messages.
>> SQL Server Books Online:
>> http://msdn2.microsoft.com/library/ms130214(en-US,SQL.90).aspx
>> --
>

About Check Constraint

Dear all,
I know Check Constraint can help stop some unwanted data pattern insert into
the field.
It can also return a system message about this.
How can I modify the check constraint return system message to a more user
friendly message in SQL Server?
Ivan
On 14 Jun, 05:33, "Ivan" <i...@.microsoft.com> wrote:
> Dear all,
> I know Check Constraint can help stop some unwanted data pattern insert into
> the field.
> It can also return a system message about this.
> How can I modify the check constraint return system message to a more user
> friendly message in SQL Server?
> Ivan
Use a TRY / CATCH block in your procedure to catch the error and
handle it accordingly.
David Portas, SQL Server MVP
Whenever possible please post enough code to reproduce your problem.
Including CREATE TABLE and INSERT statements usually helps.
State what version of SQL Server you are using and specify the content
of any error messages.
SQL Server Books Online:
http://msdn2.microsoft.com/library/ms130214(en-US,SQL.90).aspx
|||Are TRY & CATCH SQL command?
Ivan
"David Portas" <REMOVE_BEFORE_REPLYING_dportas@.acm.org>
??:1181802475.387039.108510@.d30g2000prg.googl egroups.com...
> On 14 Jun, 05:33, "Ivan" <i...@.microsoft.com> wrote:
> Use a TRY / CATCH block in your procedure to catch the error and
> handle it accordingly.
> --
> David Portas, SQL Server MVP
> Whenever possible please post enough code to reproduce your problem.
> Including CREATE TABLE and INSERT statements usually helps.
> State what version of SQL Server you are using and specify the content
> of any error messages.
> SQL Server Books Online:
> http://msdn2.microsoft.com/library/ms130214(en-US,SQL.90).aspx
> --
>
|||> Are TRY & CATCH SQL command?
Yes, introduced in SQL Server 2005.
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://sqlblog.com/blogs/tibor_karaszi
"Ivan" <ivan@.microsoft.com> wrote in message news:eq1CIi7rHHA.1848@.TK2MSFTNGP03.phx.gbl...
> Are TRY & CATCH SQL command?
> Ivan
> "David Portas" <REMOVE_BEFORE_REPLYING_dportas@.acm.org>
> ??:1181802475.387039.108510@.d30g2000prg.googl egroups.com...
>

About Check Constraint

Dear all,
I know Check Constraint can help stop some unwanted data pattern insert into
the field.
It can also return a system message about this.
How can I modify the check constraint return system message to a more user
friendly message in SQL Server?
IvanOn 14 Jun, 05:33, "Ivan" <i...@.microsoft.com> wrote:
> Dear all,
> I know Check Constraint can help stop some unwanted data pattern insert in
to
> the field.
> It can also return a system message about this.
> How can I modify the check constraint return system message to a more user
> friendly message in SQL Server?
> Ivan
Use a TRY / CATCH block in your procedure to catch the error and
handle it accordingly.
David Portas, SQL Server MVP
Whenever possible please post enough code to reproduce your problem.
Including CREATE TABLE and INSERT statements usually helps.
State what version of SQL Server you are using and specify the content
of any error messages.
SQL Server Books Online:
http://msdn2.microsoft.com/library/ms130214(en-US,SQL.90).aspx
--|||Are TRY & CATCH SQL command?
Ivan
"David Portas" <REMOVE_BEFORE_REPLYING_dportas@.acm.org>
'?:1181802475.387039.108510@.d30g2000prg.googlegroups.com...
> On 14 Jun, 05:33, "Ivan" <i...@.microsoft.com> wrote:
> Use a TRY / CATCH block in your procedure to catch the error and
> handle it accordingly.
> --
> David Portas, SQL Server MVP
> Whenever possible please post enough code to reproduce your problem.
> Including CREATE TABLE and INSERT statements usually helps.
> State what version of SQL Server you are using and specify the content
> of any error messages.
> SQL Server Books Online:
> http://msdn2.microsoft.com/library/ms130214(en-US,SQL.90).aspx
> --
>|||> Are TRY & CATCH SQL command?
Yes, introduced in SQL Server 2005.
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://sqlblog.com/blogs/tibor_karaszi
"Ivan" <ivan@.microsoft.com> wrote in message news:eq1CIi7rHHA.1848@.TK2MSFTNGP03.phx.gbl...[v
bcol=seagreen]
> Are TRY & CATCH SQL command?
> Ivan
> "David Portas" <REMOVE_BEFORE_REPLYING_dportas@.acm.org>
> '?:1181802475.387039.108510@.d30g2000prg.googlegroups.com...
>[/vbcol]