Wednesday, March 28, 2012
How to save the parameters to a RS report
Company Code, Plant, Movement type, GL Accounts, Period, Material type,
Material,etc.
Sometimes each user runs the report with the same selection except that
they change something like the period for which the report is run. Is
there a way we can provide a mechanism to the users to save the
parameters for the reports and retrieve the parameter settings for a
report and modify and run them. We can do this in Business objects.
Thanks
Kareni think you are looking for the subscriptions feature in Report Manager.
Click on a report. Next click "subscriptions" near the top. You can now
setup a subscription with different parameters.
Taz
"KarenM" <karenmiddleol@.yahoo.com> wrote in message
news:1158489967.873086.53010@.d34g2000cwd.googlegroups.com...
>I have several RS reports which have a number of parameters like
> Company Code, Plant, Movement type, GL Accounts, Period, Material type,
> Material,etc.
> Sometimes each user runs the report with the same selection except that
> they change something like the period for which the report is run. Is
> there a way we can provide a mechanism to the users to save the
> parameters for the reports and retrieve the parameter settings for a
> report and modify and run them. We can do this in Business objects.
> Thanks
> Karen
>|||Hi Tarun,
No I know of subscriptions that is when I expect the report to run in
background. What I am looking for is if users run the same report many
times with a specific parameters it is not convenient for them to type
them everytime they would like to save the parameters and retrieve and
use them
Thanks
Karen
Tarun Mistry wrote:
> i think you are looking for the subscriptions feature in Report Manager.
> Click on a report. Next click "subscriptions" near the top. You can now
> setup a subscription with different parameters.
> Taz
>
> "KarenM" <karenmiddleol@.yahoo.com> wrote in message
> news:1158489967.873086.53010@.d34g2000cwd.googlegroups.com...
> >I have several RS reports which have a number of parameters like
> > Company Code, Plant, Movement type, GL Accounts, Period, Material type,
> > Material,etc.
> >
> > Sometimes each user runs the report with the same selection except that
> > they change something like the period for which the report is run. Is
> > there a way we can provide a mechanism to the users to save the
> > parameters for the reports and retrieve the parameter settings for a
> > report and modify and run them. We can do this in Business objects.
> >
> > Thanks
> > Karen
> >|||This is not a feature that is included in the product.
We created a system that did this. The first step is that you have to
create your own Visual Studio application that you will use for
reporting, probably including a ReportViewer control.
You would create your own fields on the screen to accept these
parameters.
Then you would have to create a system for saving the reports.
We collected all the paramters into an xml string and saved it to a
table, along with a userID and a name the user gave to the particular
parameter set.
KarenM wrote:
> Hi Tarun,
> No I know of subscriptions that is when I expect the report to run in
> background. What I am looking for is if users run the same report many
> times with a specific parameters it is not convenient for them to type
> them everytime they would like to save the parameters and retrieve and
> use them
> Thanks
> Karen
> Tarun Mistry wrote:
> > i think you are looking for the subscriptions feature in Report Manager.
> >
> > Click on a report. Next click "subscriptions" near the top. You can now
> > setup a subscription with different parameters.
> >
> > Taz
> >
> >
> > "KarenM" <karenmiddleol@.yahoo.com> wrote in message
> > news:1158489967.873086.53010@.d34g2000cwd.googlegroups.com...
> > >I have several RS reports which have a number of parameters like
> > > Company Code, Plant, Movement type, GL Accounts, Period, Material type,
> > > Material,etc.
> > >
> > > Sometimes each user runs the report with the same selection except that
> > > they change something like the period for which the report is run. Is
> > > there a way we can provide a mechanism to the users to save the
> > > parameters for the reports and retrieve the parameter settings for a
> > > report and modify and run them. We can do this in Business objects.
> > >
> > > Thanks
> > > Karen
> > >|||That is exactly what we are after. Could you kindly share the code for
the same. It is such a vital requirement for users I am surprised that
Microsoft missed including this in one of the RS support packs.
Thanks
Karen
cowznofsky wrote:
> This is not a feature that is included in the product.
> We created a system that did this. The first step is that you have to
> create your own Visual Studio application that you will use for
> reporting, probably including a ReportViewer control.
> You would create your own fields on the screen to accept these
> parameters.
> Then you would have to create a system for saving the reports.
> We collected all the paramters into an xml string and saved it to a
> table, along with a userID and a name the user gave to the particular
> parameter set.
> KarenM wrote:
> > Hi Tarun,
> >
> > No I know of subscriptions that is when I expect the report to run in
> > background. What I am looking for is if users run the same report many
> > times with a specific parameters it is not convenient for them to type
> > them everytime they would like to save the parameters and retrieve and
> > use them
> >
> > Thanks
> > Karen
> > Tarun Mistry wrote:
> > > i think you are looking for the subscriptions feature in Report Manager.
> > >
> > > Click on a report. Next click "subscriptions" near the top. You can now
> > > setup a subscription with different parameters.
> > >
> > > Taz
> > >
> > >
> > > "KarenM" <karenmiddleol@.yahoo.com> wrote in message
> > > news:1158489967.873086.53010@.d34g2000cwd.googlegroups.com...
> > > >I have several RS reports which have a number of parameters like
> > > > Company Code, Plant, Movement type, GL Accounts, Period, Material type,
> > > > Material,etc.
> > > >
> > > > Sometimes each user runs the report with the same selection except that
> > > > they change something like the period for which the report is run. Is
> > > > there a way we can provide a mechanism to the users to save the
> > > > parameters for the reports and retrieve the parameter settings for a
> > > > report and modify and run them. We can do this in Business objects.
> > > >
> > > > Thanks
> > > > Karen
> > > >
Monday, March 26, 2012
How to Save Image from VB 6 to Sql DB
I Want To Save My Picture From Vb 6 To Sql Data Base In Picture Field...plz Help Me What Code I Shlould Use..
Waiting Fro Ur Hopefull ReplayRefer these
http://www.aspfaq.com/show.asp?id=2149
http://www.microsoft.com/technet/prodtechnol/sql/2000/reskit/part3/c1161.mspx
How to save for xml statement into a file
Hi
I have a T-SQL like :
Code Snippet
select * from customers for xml PATH , ROOTand how to save the result to a xml file .
Refer to Books Online about using BCP.
Look in Books Online, Topic: 'BCP Utility'
Wednesday, March 21, 2012
How to run an exe in the SSIS scripting task
Hi,
Can anyone help me how to run an exe file in the scripting task.
I was trying the below code but it's giving an error.
Set wshShell = WScript.CreateObject ("WSCript.shell")
wshshell.run "c:\Test\ABC.exe", 6, True
set wshshell = nothing
Thanks,
rkn
Here's one way. You may want to check out the MSDN for any security risks, etc.
Dim procID As Integer
procID = Shell("""C:\Program Files\Microsoft Office\OFFICE11\winword.exe"" c:\temp\test.doc")
Larry Pope|||
I would be inclined to choose .NET's Process.Start method as the more language-neutral approach...but it's possible that this is what the VB Shell command calls anyway.
-Doug
|||I believe the Process.Start method has the limitation of not being able
to add cmdline parameters, which was included in the original posters
code.
If I'm wrong about the Process.Start method not being able to use
cmdline parameters, please post some code. I would love to be
able to use that rather than Shell.
Larry|||
I think what you are looking for is something like this:
System.Diagnostics.ProcessStartInfo startInfo = new System.Diagnostics.ProcessStartInfo(Setting.PostProcessor,commandLineArgs);
startInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Normal;
startInfo.WorkingDirectory = "C:\\Test";
startInfo.UseShellExecute = false;
System.Diagnostics.Process process = new System.Diagnostics.Process();
process.StartInfo = startInfo;
process.Start();
Hossein Riazi
|||The Start method also has other overloads suited for command line arguments, such as
Process.Start Method (String, String)
Starts a process resource by specifying the name of an application and a set of command-line arguments, and associates the resource with a new Process component.
-Doug
Monday, March 12, 2012
How to return a value from Stored Procedure?
I am calling a stored procedure from my Java script app and trying to use
the returned value later on in my app.
Here is the javascript code.
var connObj = Server.CreateObject("ADODB.connection");
connObj.Open("DRIVER={ SQL Server }; SERVER = 9.1.2.1;
DATABASE=TEST","sa","xyz");
var recordSetObj = Server.CreateObject("ADODB.Recordset");
var StrName = "venkat";
var RetVal;
var query = "Exec ProcSP '"+StrName+'", '"+RetVal+"'";
recordSetObj.Open(query,connObj);
Response.Write("Return Value= "+RetVal);
/******Stored Procedure********/
Create Procedure ProcSP
@.StrName nvarchar(10),
@.RetVal integer OUTPUT
AS
SET RetVal = 1
return
GO
The value returned is empty, even if I initialize RetVal to 2 say before the
call of Store procedure then once the execution of stored procedure is
finished it prints as 2 only. It is not getting changed to 1.
Please note the stored procedure is working fine if i execute any queries, i
mean the stored procedure is getting called from the app and is working
properly the only thing is i am not able to return any value from it.
I greatly appreciate anyhelp on this, i need to fix this issue ASAP, i am
running short of time. Please help me.
Regards,
VenkatHave you tried using parameters and the command object?
That's typically how you retrieve the values of output
parameters and return values in ADO.
-Sue
On Fri, 28 Nov 2003 11:09:31 +0530, "Venkat"
<venkat_kp@.yahoo.com> wrote:
quote:
>Hi,
>I am calling a stored procedure from my Java script app and trying to use
>the returned value later on in my app.
>Here is the javascript code.
>var connObj = Server.CreateObject("ADODB.connection");
>connObj.Open("DRIVER={ SQL Server }; SERVER = 9.1.2.1;
>DATABASE=TEST","sa","xyz");
>var recordSetObj = Server.CreateObject("ADODB.Recordset");
>var StrName = "venkat";
>var RetVal;
>var query = "Exec ProcSP '"+StrName+'", '"+RetVal+"'";
>recordSetObj.Open(query,connObj);
>Response.Write("Return Value= "+RetVal);
>
>/******Stored Procedure********/
>Create Procedure ProcSP
>@.StrName nvarchar(10),
>@.RetVal integer OUTPUT
>AS
>SET RetVal = 1
>return
>GO
>
>The value returned is empty, even if I initialize RetVal to 2 say before th
e
>call of Store procedure then once the execution of stored procedure is
>finished it prints as 2 only. It is not getting changed to 1.
>Please note the stored procedure is working fine if i execute any queries,
i
>mean the stored procedure is getting called from the app and is working
>properly the only thing is i am not able to return any value from it.
>
>I greatly appreciate anyhelp on this, i need to fix this issue ASAP, i am
>running short of time. Please help me.
>
>Regards,
>Venkat
>
>
>
How to return a Table to VS using Stored Procedure
Code Snippet
ALTER PROCEDURE dbo.SelectHWCategoryBased
(
@.title varchar /* Like Processor/RAM */
)
AS
SELECT Hardwares.HWID, Hardwares.Title
FROM Hardwares INNER JOIN
Category ON Hardwares.CategoryID = Category.CategoryID
WHERE (Category.Type LIKE '%Hardware%') AND (Category.Title = @.Title)
There is no issue on your SP.
You have to use the SQLDataAdapater to fill the dataset. Use the current command object as SelectCommand of the Adapter & call the Fill() method.. Check with ADO.NET forum
|||
@.title varchar /* Like Processor/RAM */
The default size for an incoming varchar parameter is one character. If your incoming parameter value is longer than one character, it is being truncated, and the WHERE clause is looking for a Category.Title that matches the single character.
Probably won't find one.
Change the parameter to varchar(n) -n being sized appropriate to your Title field.
|||Thanks, that works, missed out that.How to Return a subset of resultset of some stored proc
Hi,
I want to write a query to select some of the columns from result of stored proc,
My expected code will be like that, but its not allowed,
Select first_Name, Last_Name, Last_Used_date from (Execute sp_reportNumber15 '9555')
I have around 30 different stored proc but I know some of the columns are in resultset of every stored proc, So I want to write a generalize stored proc to whom I will just pass stored proc name and it will return me the subset of its result.
Thanks,
Imran.
Imran:
I would first try to convince you to take another approach. Reports -- especially heavy reports -- can be very resource intensive. And to take the results of some 30 different reports and the massage these results and take small subsets of each report and the presenting the results to an end user sounds like doing a lot of work to simplify the coding of a developer. To me this is putting the work in the wrong place.
When I implement a database one of my goals always is to provide service to each request as fast as possible. The implementation you propose does not aim at that goal. To me, the implementation you propose aims at taking a round-about path to gathering the data and hoping that the response to the request might be fast enough. This brings to me visions of dozens of tables being table scanned when the data from much fewer tables is needed. If it were my server I would view this as abuse.
Please, rethink this before you go forward.
|||
Dave
Hi Dave,
I have not written that I want to compile resultset of 30 reports at the same time. The scenario is like as,
One enduser want sometimes 5 specific columns from resultset of sp_report1, sometime he needs same 5 columns from resultset of sp_report2, in actual the number of columns returned in resultsets is different of sp_report1 and sp_report2 but same 5 columns are present in resultset of every sp, like sp_report1 return 30 columns, and sp_report4 returns 15 columns.
I want to write a new stored proc for him, say for example sp_getData 'sp_report1'. By this kind of stored proc he doesnt need to fetch full resultset of every sp, this will reduce network load also,
when user passes the parameter value as sp_report1, then I will return 5 columns from resultset of report1, and when user passes parameter value as 'sp_report15' then I will return 5 columns from resultset of report15
My question is only that, if you have a vision to write this kind of statement, conceptually my statement will be as,
Select Col1, Col4, Col6, Col7, Col9 from (Exec sp_getData @.repnumber)
but syntactically it is wrong, if there is some possibility then just reply otherwise dont waste your time as well as my time.
thanks,
Imran.
|||convert your sp into function..
so you can do Select Col1, Col4, Col6, Col7, Col9 from fn_getData (@.repnumber) as Data
|||Thank you so much ... :D
This is exactly what I want...
so nice of you
Friday, March 9, 2012
How to Retrive single data from sqldatasource control
i need to code for retrieving single data from sqldatasource control. i need the full set of coding
connecting
retrieving data in text box
editing data to the table
updating data to the table
deleting data to the table
i want to fetch "single field data"
any one who know the code please post reply or send it to my mail senthilonline_foryou@.rediffmail.comI suggest that you use a stored procedure like this (assuming ID is an identity index column, with a data row NAME VARCHAR(50) in Table Fred)
CREATE PROCEDURE dbo.uspGetFred
(
@.ID INT,
@.NAME VARCHAR(50) OUTPUT
)
SET NOCOUNT ON
SELECT NAME FROM Fred WHERE ID = @.ID
GO
The VB code below retrieves NAME into aName fpor a given value of iID
CONST DBCONNECT As String = "Your Connect String"
Dim sName As String = ""
Dim xSqlConnection As SqlConnection = New SqlConnection(DBCONNECT )
Dim xSqlCommand As SqlCommand = New SqlCommand("uspGetFred", xSqlConnection)
Try
xSqlCommand.CommandType = CommandType.StoredProcedure
xSqlCommand.Parameters.Add("@.ID", SqlDbType.Int)
xSqlCommand.Parameters("@.ID").Value = CType(iId, Integer)
xSqlCommand.Parameters.Add("@.NAME", SqlDbType.VarChar, 50)
xSqlCommand.Parameters("@.NAME").Direction = ParameterDirection.Output
xSqlCommand.Connection.Open()
xSqlCommand.ExecuteNonQuery()
sName = xSqlCommand.Parameters("@.NAME").Value
Catch ex As Exception
' Handle your error here!
Finally
xSqlCommand.Connection.Close()
xSqlCommand.Dispose()
xSqlConnection.Dispose()
End Try
HTH!
Wednesday, March 7, 2012
How to retrieve the actions using MDSCHEMA_ACTIONS?
Hello,
When I run the following code, I get an empty schema.
Dim drAction As DataRow
Dim dsActions As DataSet
dsActions = MyConnection.GetSchemaDataSet(AdomdSchemaGuid.Actions, _
New Object() {szDatabase, Nothing, szCubeName, Nothing, Nothing, szCubeName, 1})
The result:
dsActions.Tables.Count = 1 but dsActions.Tables(0).Rows.Count = 0
Even though my cube contains two actions as it is shown in the following:
<Actions>
<Action xsi:type="DrillThroughAction">
<ID>Drillthrough Action</ID>
<Name>Drillthrough Action</Name>
<TargetType>Cells</TargetType>
<Target>MeasureGroupMeasures("Values Measure")</Target>
<Type>DrillThrough</Type>
<Default>true</Default>
<MaximumRows>3</MaximumRows>
</Action>
<Action xsi:type="DrillThroughAction">
<ID>Drillthrough Action 1</ID>
<Name>Drillthrough Action 1</Name>
<TargetType>Cells</TargetType>
<Target>MeasureGroupMeasures("Values Measure")</Target>
<Type>DrillThrough</Type>
<Default>true</Default>
<MaximumRows>2</MaximumRows>
</Action>
</Actions>
Thanks,
yones
hello Yones,
i think the problem is with the restrictions you specify. I think coordinate and coordinate type in this case should be: Coordinate type should be Cell (6) and Coordinate should be a tuple defining your cell. (right now it looks like they are for cube object). So for example the query could look like (for Adventure Works)
dsActions = MyConnection.GetSchemaDataSet(AdomdSchemaGuid.Actions, _
New Object() {
"Adventure Works DW", // CATALOG_NAME
Nothing, // SCHEMA_NAME
"Adventure Works", // CUBE_NAME
Nothing, // ACTION_NAME
Nothing, // ACTION_TYPE
"([Customer].[Customer Geography].[Country].&[Canada],[Measures].[Internet Extended Amount])", // COORDINATE
6}) // COORDINATE_TYPE : MDACTION_COORDINATE_CELL (6)
hope this helps,
|||Hello Mary,
First thank you very much for your help.
I tried Cell actions instead of Cube actions as it is shown in the following code:
dsActions = MyConnection.GetSchemaDataSet(AdomdSchemaGuid.Actions, _
New Object() {"AmoAdventureWorks", Nothing, "Adventure Works", Nothing, Nothing, "[Date].[Calendar Month Name].[All Periods],[Customer].[City].[All Customers],[Measures].[Reseller Sales Amount]", 6})
But the result was the same:
dsActions.Tables.Count = 1
dsActions.Tables(0).Rows.Count = 0
And my cube contains the following action:
<Actions>
<Action xsi:type="DrillThroughAction">
<ID>Drillthrough Action 1</ID>
<Name>Drillthrough Action</Name>
<TargetType>Cells</TargetType>
<Target>MeasureGroupMeasures("Reseller Sales")</Target>
<Type>DrillThrough</Type>
<Default>true</Default>
<MaximumRows>4</MaximumRows>
</Action>
</Actions>
Please let me know if you notice any wrong in my code.
Again thank you
Yones|||hello Yones,
i think you might be missing () inside a coordinate. I.e. i think it should be "([Date].[Calendar Month Name].[All Periods],[Customer].[City].[All Customers],[Measures].[Reseller Sales Amount])".
hope this helps,
How to retrieve the actions using MDSCHEMA_ACTIONS?
Hello,
When I run the following code, I get an empty schema.
Dim drAction As DataRow
Dim dsActions As DataSet
dsActions = MyConnection.GetSchemaDataSet(AdomdSchemaGuid.Actions, _
New Object() {szDatabase, Nothing, szCubeName, Nothing, Nothing, szCubeName, 1})
The result:
dsActions.Tables.Count = 1 but dsActions.Tables(0).Rows.Count = 0
Even though my cube contains two actions as it is shown in the following:
<Actions>
<Action xsi:type="DrillThroughAction">
<ID>Drillthrough Action</ID>
<Name>Drillthrough Action</Name>
<TargetType>Cells</TargetType>
<Target>MeasureGroupMeasures("Values Measure")</Target>
<Type>DrillThrough</Type>
<Default>true</Default>
<MaximumRows>3</MaximumRows>
</Action>
<Action xsi:type="DrillThroughAction">
<ID>Drillthrough Action 1</ID>
<Name>Drillthrough Action 1</Name>
<TargetType>Cells</TargetType>
<Target>MeasureGroupMeasures("Values Measure")</Target>
<Type>DrillThrough</Type>
<Default>true</Default>
<MaximumRows>2</MaximumRows>
</Action>
</Actions>
Thanks,
yones
hello Yones,
i think the problem is with the restrictions you specify. I think coordinate and coordinate type in this case should be: Coordinate type should be Cell (6) and Coordinate should be a tuple defining your cell. (right now it looks like they are for cube object). So for example the query could look like (for Adventure Works)
dsActions = MyConnection.GetSchemaDataSet(AdomdSchemaGuid.Actions, _
New Object() {
"Adventure Works DW", // CATALOG_NAME
Nothing, // SCHEMA_NAME
"Adventure Works", // CUBE_NAME
Nothing, // ACTION_NAME
Nothing, // ACTION_TYPE
"([Customer].[Customer Geography].[Country].&[Canada],[Measures].[Internet Extended Amount])", // COORDINATE
6}) // COORDINATE_TYPE : MDACTION_COORDINATE_CELL (6)
hope this helps,
|||Hello Mary,
First thank you very much for your help.
I tried Cell actions instead of Cube actions as it is shown in the following code:
dsActions = MyConnection.GetSchemaDataSet(AdomdSchemaGuid.Actions, _
New Object() {"AmoAdventureWorks", Nothing, "Adventure Works", Nothing, Nothing, "[Date].[Calendar Month Name].[All Periods],[Customer].[City].[All Customers],[Measures].[Reseller Sales Amount]", 6})
But the result was the same:
dsActions.Tables.Count = 1
dsActions.Tables(0).Rows.Count = 0
And my cube contains the following action:
<Actions>
<Action xsi:type="DrillThroughAction">
<ID>Drillthrough Action 1</ID>
<Name>Drillthrough Action</Name>
<TargetType>Cells</TargetType>
<Target>MeasureGroupMeasures("Reseller Sales")</Target>
<Type>DrillThrough</Type>
<Default>true</Default>
<MaximumRows>4</MaximumRows>
</Action>
</Actions>
Please let me know if you notice any wrong in my code.
Again thank you
Yones|||hello Yones,
i think you might be missing () inside a coordinate. I.e. i think it should be "([Date].[Calendar Month Name].[All Periods],[Customer].[City].[All Customers],[Measures].[Reseller Sales Amount])".
hope this helps,
How to retrieve SqlDbType.Bit in SQL server?
My checkbox status is saved as SqlDbType.Bit in MS SQl Server database.
When I use the following code to retrieve it, it does not work.
myRow[myColumn].ToString()=="1"
I appreciate your kind assistance.
Thank you.Just use
myRow[myColumn] == true
How to retrieve SQL error code from the Error object?
I'm using MS SQL 2000 as a server and Delphi 7 over ADO as a client. On the
server side i have created stored procedure that can raise an error with
some SQL error code like 547 or 550 and i want to catch this code on the
client side to log and to call other procedure, but Error object does not
pass this code, there are only OLE DB error code (same for different errors)
and Description, but NativeError and SQLState fields is empty. How can i
recieve SQL error code over Error object? Thanks!
Best regards, Konstantin KnyazevKostya
There are some errors in SQL Server that terminate batch immediately after
raising like Violation of PRIMARY KEY constraint. In your case I'd try to do
that on the server side
CREATE PROC myProc
AS
--Do something
IF @.@.ERROR <>0
RETURN -1
ELSE
RETURN 0
DECLARE @.err INT
EXEC @.err=myProc
IF @.err =-1
PRINT 'I have got an error'
"Konstantin Knyazev" <kknyazev_no_spam_@.mail.ru> wrote in message
news:O7pl8EvLFHA.1144@.TK2MSFTNGP09.phx.gbl...
> Hello!
> I'm using MS SQL 2000 as a server and Delphi 7 over ADO as a client. On
the
> server side i have created stored procedure that can raise an error with
> some SQL error code like 547 or 550 and i want to catch this code on the
> client side to log and to call other procedure, but Error object does not
> pass this code, there are only OLE DB error code (same for different
errors)
> and Description, but NativeError and SQLState fields is empty. How can i
> recieve SQL error code over Error object? Thanks!
> Best regards, Konstantin Knyazev
>|||Hi
You can cycle throught the errors in the connection object such as:
procedure TForm1.Button1Click(Sender: TObject);
var
i:integer;
begin
try
form2.show;
sp.ExecProc;
except
on e: Eaccessviolation do
showmessage(e.message)
else
if cnn.errors.Count <> 0 then
begin
for i:=0 to cnn.errors.count-1 do
showmessage(cnn.errors[i].desc_ription);
end;
end;
end;
from the thread http://tinyurl.com/4trhq
John
"Konstantin Knyazev" wrote:
> Hello!
> I'm using MS SQL 2000 as a server and Delphi 7 over ADO as a client. On th
e
> server side i have created stored procedure that can raise an error with
> some SQL error code like 547 or 550 and i want to catch this code on the
> client side to log and to call other procedure, but Error object does not
> pass this code, there are only OLE DB error code (same for different error
s)
> and Description, but NativeError and SQLState fields is empty. How can i
> recieve SQL error code over Error object? Thanks!
> Best regards, Konstantin Knyazev
>
>|||Hi!
In my case, Connection.Errors collection is empty, probably due a
asynchronious call, there are only Error object passed in the parameters of
the ExecuteComplete method.
"John Bell" <JohnBell@.discussions.microsoft.com> wrote in message
news:87F6042E-5AFD-4118-A7F9-E7FBB0C8EB4C@.microsoft.com...
> Hi
> You can cycle throught the errors in the connection object such as:
> procedure TForm1.Button1Click(Sender: TObject);
> var
> i:integer;
> begin
> try
> form2.show;
> sp.ExecProc;
> except
> on e: Eaccessviolation do
> showmessage(e.message)
> else
> if cnn.errors.Count <> 0 then
> begin
> for i:=0 to cnn.errors.count-1 do
> showmessage(cnn.errors[i].desc-ription);
> end;
>
> end;
> end;
> from the thread http://tinyurl.com/4trhq
> John
> "Konstantin Knyazev" wrote:
>
the
not
errors)|||It was a while since I did something similar, but I can recall having to use
error values of at least a certain number, otherwise SQL Server supresses
them, you would need to check the documentation to confirm this..
"Konstantin Knyazev" wrote:
> Hello!
> I'm using MS SQL 2000 as a server and Delphi 7 over ADO as a client. On th
e
> server side i have created stored procedure that can raise an error with
> some SQL error code like 547 or 550 and i want to catch this code on the
> client side to log and to call other procedure, but Error object does not
> pass this code, there are only OLE DB error code (same for different error
s)
> and Description, but NativeError and SQLState fields is empty. How can i
> recieve SQL error code over Error object? Thanks!
> Best regards, Konstantin Knyazev
>
>|||Hello!
Yes, i did it, but further i have changed system to use linked servers and
distributed query that requires XACT_ABORT ON, but your method requires
XACT_ABORT OFF.
Best regards, Konstantin Knyazev
"Uri Dimant" <urid@.iscar.co.il> wrote in message
news:%23BQSdu3LFHA.2988@.TK2MSFTNGP14.phx.gbl...
> Kostya
> There are some errors in SQL Server that terminate batch immediately
after
> raising like Violation of PRIMARY KEY constraint. In your case I'd try to
do
> that on the server side
> CREATE PROC myProc
> AS
> --Do something
> IF @.@.ERROR <>0
> RETURN -1
> ELSE
> RETURN 0
> --
> DECLARE @.err INT
> EXEC @.err=myProc
> IF @.err =-1
> PRINT 'I have got an error'
>
>
>
>
>
>
> "Konstantin Knyazev" <kknyazev_no_spam_@.mail.ru> wrote in message
> news:O7pl8EvLFHA.1144@.TK2MSFTNGP09.phx.gbl...
> the
not
> errors)
>|||Errors that i'm trying to catch is 547 and 550. Sorry, can you give me a
link to article? I can't find anything :(
Best regards, Konstantin Knyazev
"Mike (adoanywhere)" <Mikeadoanywhere@.discussions.microsoft.com> wrote in
message news:B2304F57-46C6-4033-AB7D-639E89994413@.microsoft.com...
> It was a while since I did something similar, but I can recall having to
use
> error values of at least a certain number, otherwise SQL Server supresses
> them, you would need to check the documentation to confirm this..
> "Konstantin Knyazev" wrote:
>
the
not
errors)|||For my problem I was using RAISERROR in SQL Server Stored Proc
[http://msdn.microsoft.com/library/d...r />
_5ooi.asp]
Try modifying the paramters until you get a reply back to the client. Since
I dont know exactly what you are doing I cant be more specific. But in my
case I wrote a small app to test these paramters until I got a result.
"Konstantin Knyazev" wrote:
> Errors that i'm trying to catch is 547 and 550. Sorry, can you give me a
> link to article? I can't find anything :(
> Best regards, Konstantin Knyazev
> "Mike (adoanywhere)" <Mikeadoanywhere@.discussions.microsoft.com> wrote in
> message news:B2304F57-46C6-4033-AB7D-639E89994413@.microsoft.com...
> use
> the
> not
> errors)
>
>
Friday, February 24, 2012
How to retrieve Data from SQL SERVER 2000 ?
Hello,
Im using Visual Studio 2005 to code ASP.NET
How to query my MS SQL SERVER 2000 to retrieve data from my DataBase?
Ive tried some tutorials, but i kept giving me errors
Can you put a simple source code to retrieve something like "select userID, Name, Age from Users"
Thank you,
Are you able to connect to your database?
|||First have you tried the gridview control that auto creates your select statement by you defining options in VS 2005 wizards?
Check out this tutorial on how to do a grid with a simple select statement.
http://www.devx.com/dotnet/Article/22141
how to retriece single record in database by using SqlDataSource??
Is me again,and now i facing problem to retrieve a single record from the database.
here is my code:
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim user As String
user = TextBox1.Text
Dim varpassword
Dim mydata As SqlDataSource
mydata.SelectCommand = "Select * from tbluser where uLogin = '" & user & "'"
varpassword = mydata.SelectCommand.uPassword
End Sub
End Class
but i get the error : 'uPassword' is not a member of 'String'
i wan to retrieve the password of that user,can anyone help me?
thanks
First create a select parameter "uPassword" of type "String".
|||
Girijesh:
First create a select parameter "uPassword" of type "String".
i not really understand about creating the select parameter.
can u write the line of code for me?thanks
Hi there,
Use this:
imports System.Data.Sql
Dim dt as new DataTable
Dim query As String = "Select * from tbluser where uLogin = '" & user & "'"
Dim conn as new SqlConnection(connection)
Dim adapter as new SqlDataAdapter
adapter.SelectCommand =new SqlCommand(query, conn);
adapter.Fill(dt);
// this DataTable only has one row, the one for this username
Dim password As String = dt.rows(0)("uPassword")
hope it helps you out,
gonzzas