Showing posts with label net. Show all posts
Showing posts with label net. Show all posts

Friday, March 30, 2012

How to get todays date in format YY/MM/DD and to compare it to another date passed into th

I need to do the following and am hoping someone can help me out.

I have C#(asp.net app) that will call a stored procedure. The C# will pass in a date to the
stored procedure. The date is in the format YY/MM/DD. Once inside of the stored procedure, the date
passed into the stored proc needs to be compared to todays date. Todays date must be determined in
the SQL.

So basically here is my pseudo code for what I am trying to accomplish. Basically I just am after
the comparison of the two values:

If @.BeginDate < TodaysDate

The difficult part is how to obtain the value for "TodaysDate"

Taking into consideration that "TodaysDate" should probably be in the format of YY/MM/DD considering that is how the date it is to be compared with is being passed in.

Can someone please code this out for me in Microsoft SQL. I would be forever grateful.

I figured out what I needed to know, but will have further questions and will need help. Thanks to all.

How to get the value of a SQL query before binding it to DataGrid?

I am using C#.Net, Visual web Developer, SQL server 2000.

I have a SQL query which I am binding it to a DataGrid.

SQL : "SELECT ord_number, ord_ID, ord_split, ord_Name, ETD_Date, OSP_FSD FROM ORDERS"

In My DataGrid I have a dynamic databound column.

I am able to bind one column to this databound column using following code.

BoundColumn ETDDate = new BoundColumn();
ETDDate.HeaderText = "ETD Date";
ETDDate.DataField = "OSP_FSD";
mygrid2.Columns.AddAt(ETDDate);

but now I want to bind this databound column based on the following criteria to two different database columns.

if(ord_split = 1)
{
ETDDate.DataField = "OSP_FSD";
}
else
{
ETDDate.DataField = "ETD_Date";
}

How to get value of ord_split before binding SQL to teh DataGrid? i.e I just want to take value of ord_split and not all the values of SQL.

Please Help!

HI~

ord_split if different in each row but if you change ETDDate.DataField it will affect all rows.

I am afraid you just want to display OSP_FSD for the rows " ord_split =1 " or ETD_Date if not.

If so you can change the text inGridView'sRowDataBound Event.

Wednesday, March 28, 2012

How to get the system date and time into database

Hi,

I m using ASP.NET with C#.
I m having one field which should store the datetime of the system.

The datetime should be automatically stored for that entry when the user submits that record on the click event.
Then it should display the date time on the gridview from database.

I m using sqlserver 2005 and i have created the stored procedure for the insert command.

Thisis the sample sp what should be written here to insert system date timeautomatically when the user submits the asp.net form ?

Is there any code for writing directly in stored procedure or asp.net coding page...


ALTER PROCEDURE [dbo].[StoredProcedure1]

@.salesid INT OUTPUT,
@.salesdate datetime,
@.customername varchar(20)

AS
BEGIN
SET NOCOUNT ON

BEGIN
INSERT INTO sales (customername)
VALUES (@.customername)
SELECT @.companyid = SCOPE_IDENTITY()
END

SET NOCOUNT OFF
END

 
Thanxs in advance...

Hi,

use getdate() function of sql server.

for more info look here

http://msdn2.microsoft.com/en-us/library/ms188383.aspx

|||

You have a choice as to where to use the getdate() function (which returns the current system date and time).

You can actually define it on a column in the table itself so that you don't have to set it programmatically. Here is sample syntax:

create table sales (sales_id int identity, customer_name varchar(30) not null,sales_date datetime default getdate() not null)

Alternatively, within the stored procedure assign your variable with the function call. Here is sample syntax:

select @.SystemDate = getdate()

How to get the SQL database size

Is it possible to get the SQL Server database size programmatically?
I have an WEB application in c# ASP NET, but I can found any information about.

Thanks for your attention

Freedeveloperread this post:
http://www.asp.net/Forums/ShowPost.aspx?tabindex=1&PostID=601604|||Hello!

Ok, Thank for the help.
I resolve the question in microsoft c# forum wit the use of sp_helpdb

SqlCommand cmd = new SqlCommand("sp_helpdb",objConexion);
cmd.CommandType=CommandType.StoredProcedure;
cmd.Parameters.Add("@.dbname",databasename);

this store procedure return the database size and another data.

thaks,

Freedevelopersql

Wednesday, March 21, 2012

How to get the current User when using a general connection user

I have a VB.Net app and a SQL Server 2005 database. Users must login to use
the application, and I have an Employee table to store their details.
However, I use a common user ID to connect to the database (for reasons I
won't go into here).
My problem is, some of my triggers need to know who the current user is, and
of course I can't use the current connection information to get this as I
always get the common user ID.
Does anyone have a technique to solve this dilema? Maybe some way to set a
variable or something when I connect so that I can determine which user has
initiated the connection?You can use application roles to achieve that. Works something like this:
a) Every user has a Windows account using Windows Authentication
b) When they run the application you enable the application role
c) Inside the application's session you can look at what the username is,
including in triggers, using suser_sname()
Hope this helps,
Ben Nevarez, MCDBA, OCP
Database Administrator
"David" wrote:

> I have a VB.Net app and a SQL Server 2005 database. Users must login to us
e
> the application, and I have an Employee table to store their details.
> However, I use a common user ID to connect to the database (for reasons I
> won't go into here).
> My problem is, some of my triggers need to know who the current user is, a
nd
> of course I can't use the current connection information to get this as I
> always get the common user ID.
> Does anyone have a technique to solve this dilema? Maybe some way to set a
> variable or something when I connect so that I can determine which user ha
s
> initiated the connection?
>

How to get the current date in C# and how do I pass this date to SQL Server

I am writing a ASP.NET C# web application. I will need to store the date in one field in one of my tables. It appears that I need to use the datetime data type for the date in SQL Server 2005.

So I have a question

1.) How do I get today's date in C# and how should this be passed to SQL server?

you can get the current date directly in SQL using getdate()|||Doing it in C# will return you the client system date. Getting the current date in SQL will ensure all datetime recorded in your application are in sync. If you are using the date for some sort of comparison determine the sequence of event, using the date from the client might pose some timing issue. Unless what you want is really the client's local time, you should use the Server time.|||

brgdotnet:

I am writing a ASP.NET C# web application. I will need to store the date in one field in one of my tables. It appears that I need to use the datetime data type for the date in SQL Server 2005.

So I have a question

1.) How do I get today's date in C# and how should this be passed to SQL server?

to get current date in c# use DateTime.Now.ToString()......... there is also some different methods under Now... use what is appropriate for u .


if u r using a procedure it is easier.... say proc. name saveCurrentDate

String s=DateTime.Now.ToString();

String queryString="saveCurrentDate '"+s+"'"; //// or String queryString="insert int myTable(mydate) values ('"+s+"')";

hope it will hellped u


|||

Actually I am processing some records from a comma delimited .txt file. Each item seperated by a comma, will map to a field in a SQL Server database table.

The date is in the format: 20070423, that is YYMMDD

So I need to take the date value and then write it into SQL server. So this brings us to another question. Do I need to change this date format to comply with that of SQL server? If so what format does it need to be in? I need some specifics so if you could even produce a code sample for C#, that would be great.

|||You can pass in the date in format YYYYMMDD as a string. SQL Server will implicitly convert it to string. As long as you are using Universal format YYYYMMDD, it is fine. Other format like MMDDYYYY or DDMMYYYY will be depending on the language setting that you used. So stick to YYYYMMDD and you will not go wrong.|||

I am confused about one thing though? I am reading from a text file where the format is in YYMMDD. Should I store this in SQL server as a data type of datetime or smalldatetime?

If so, I definitely have a date that, I can read from the text file, but I don't have a time? What do you think? If I did use datetime, would it just append the current time to the date I entered?

|||

you should always use proper data type for the data. In this case, you should use datetime or smalldatetime to store the date.

"I can read from the text file, but I don't have a time?"
You can still use datetime data type. Just set the time to 00:00:00. For your case, as your date string is in YYYYMMDD format without time, when you insert into table, the time will be stored as 00:00:00

How to get the beta sp 2

I am working through the issue of email not working through subscription,
which seems to be an issue for many after scouring this forum and the net
over the past few days. I have a 2003 Server running with RS, SP1 installed
but I keep getting the error that the server saying ... "Failure sending
mail: The Report Server has encountered a configuration error; more details
in the log files" and the lof files show nothing other than the error that
has been mentioned here several times ...
ReportingServicesService!library!1678!01/07/2005-07:33:07:: i INFO: Call to
RenderFirst( '/Sutter Connect/SC EDI/EDI Utilization Vendor Report' )
ReportingServicesService!library!1678!01/07/2005-07:33:07:: e ERROR:
Throwing
Microsoft.ReportingServices.Diagnostics.Utilities.ServerConfigurationErrorException:
The Report Server has encountered a configuration error; more details in the
log files, AuthzInitializeContextFromSid: Win32 error: 1355;
Info:
Microsoft.ReportingServices.Diagnostics.Utilities.ServerConfigurationErrorException:
The Report Server has encountered a configuration error; more details in the
log files
I have read through many KB articles, including 842423 and I can get it to
send just the link as mentioned in that article. I have tried the fixes and
installed the SP1 to no avail. I have reinstalled RS three times, using
different accounts (Local Admin, two different service domain accounts) and
nothing fixes the problem. I have the same issue on a test machine running
2000 Server. So I cannot get this feature to work.
Can anyone help? Does anyone know how to get the beta SP2? I am willing to
try anything. Thanks in advance.
~Sharihttp://support.microsoft.com/kb/842440 contains information about how you
can request access to SQL Server 2000 Reporting Services Beta 2.
--
Sincerely,
Stephen Dybing
This posting is provided "AS IS" with no warranties, and confers no rights.
Please reply to the newsgroups only, thanks.
"Shari" <Shari@.discussions.microsoft.com> wrote in message
news:C319A846-B349-4E06-9C67-F00843B53717@.microsoft.com...
>I am working through the issue of email not working through subscription,
> which seems to be an issue for many after scouring this forum and the net
> over the past few days. I have a 2003 Server running with RS, SP1
> installed
> but I keep getting the error that the server saying ... "Failure sending
> mail: The Report Server has encountered a configuration error; more
> details
> in the log files" and the lof files show nothing other than the error that
> has been mentioned here several times ...
> ReportingServicesService!library!1678!01/07/2005-07:33:07:: i INFO: Call
> to
> RenderFirst( '/Sutter Connect/SC EDI/EDI Utilization Vendor Report' )
> ReportingServicesService!library!1678!01/07/2005-07:33:07:: e ERROR:
> Throwing
> Microsoft.ReportingServices.Diagnostics.Utilities.ServerConfigurationErrorException:
> The Report Server has encountered a configuration error; more details in
> the
> log files, AuthzInitializeContextFromSid: Win32 error: 1355;
> Info:
> Microsoft.ReportingServices.Diagnostics.Utilities.ServerConfigurationErrorException:
> The Report Server has encountered a configuration error; more details in
> the
> log files
> I have read through many KB articles, including 842423 and I can get it to
> send just the link as mentioned in that article. I have tried the fixes
> and
> installed the SP1 to no avail. I have reinstalled RS three times, using
> different accounts (Local Admin, two different service domain accounts)
> and
> nothing fixes the problem. I have the same issue on a test machine running
> 2000 Server. So I cannot get this feature to work.
> Can anyone help? Does anyone know how to get the beta SP2? I am willing to
> try anything. Thanks in advance.
> ~Shari|||Thank you Stephen for your very quick response. I submitted a request to that
link esterday and am waiting. Is it just a waiting game? Is there any other
method of getting this SP asap?
Thanks,
Shari
"Stephen Dybing [MSFT]" wrote:
> http://support.microsoft.com/kb/842440 contains information about how you
> can request access to SQL Server 2000 Reporting Services Beta 2.
> --
> Sincerely,
> Stephen Dybing
> This posting is provided "AS IS" with no warranties, and confers no rights.
> Please reply to the newsgroups only, thanks.
> "Shari" <Shari@.discussions.microsoft.com> wrote in message
> news:C319A846-B349-4E06-9C67-F00843B53717@.microsoft.com...
> >I am working through the issue of email not working through subscription,
> > which seems to be an issue for many after scouring this forum and the net
> > over the past few days. I have a 2003 Server running with RS, SP1
> > installed
> > but I keep getting the error that the server saying ... "Failure sending
> > mail: The Report Server has encountered a configuration error; more
> > details
> > in the log files" and the lof files show nothing other than the error that
> > has been mentioned here several times ...
> >
> > ReportingServicesService!library!1678!01/07/2005-07:33:07:: i INFO: Call
> > to
> > RenderFirst( '/Sutter Connect/SC EDI/EDI Utilization Vendor Report' )
> > ReportingServicesService!library!1678!01/07/2005-07:33:07:: e ERROR:
> > Throwing
> > Microsoft.ReportingServices.Diagnostics.Utilities.ServerConfigurationErrorException:
> > The Report Server has encountered a configuration error; more details in
> > the
> > log files, AuthzInitializeContextFromSid: Win32 error: 1355;
> > Info:
> > Microsoft.ReportingServices.Diagnostics.Utilities.ServerConfigurationErrorException:
> > The Report Server has encountered a configuration error; more details in
> > the
> > log files
> >
> > I have read through many KB articles, including 842423 and I can get it to
> > send just the link as mentioned in that article. I have tried the fixes
> > and
> > installed the SP1 to no avail. I have reinstalled RS three times, using
> > different accounts (Local Admin, two different service domain accounts)
> > and
> > nothing fixes the problem. I have the same issue on a test machine running
> > 2000 Server. So I cannot get this feature to work.
> >
> > Can anyone help? Does anyone know how to get the beta SP2? I am willing to
> > try anything. Thanks in advance.
> >
> > ~Shari
>
>|||I do not know what the process is behind that link, and it might very well
be manual, so you should just give it a couple more days. Sorry, there isn't
any other way of getting it that I'm aware of.
--
Sincerely,
Stephen Dybing
This posting is provided "AS IS" with no warranties, and confers no rights.
Please reply to the newsgroups only, thanks.
"Shari" <Shari@.discussions.microsoft.com> wrote in message
news:FB15ED4B-14B9-4886-944C-EB368F658B25@.microsoft.com...
> Thank you Stephen for your very quick response. I submitted a request to
> that
> link esterday and am waiting. Is it just a waiting game? Is there any
> other
> method of getting this SP asap?
> Thanks,
> Shari
>
> "Stephen Dybing [MSFT]" wrote:
>> http://support.microsoft.com/kb/842440 contains information about how you
>> can request access to SQL Server 2000 Reporting Services Beta 2.
>> --
>> Sincerely,
>> Stephen Dybing
>> This posting is provided "AS IS" with no warranties, and confers no
>> rights.
>> Please reply to the newsgroups only, thanks.
>> "Shari" <Shari@.discussions.microsoft.com> wrote in message
>> news:C319A846-B349-4E06-9C67-F00843B53717@.microsoft.com...
>> >I am working through the issue of email not working through
>> >subscription,
>> > which seems to be an issue for many after scouring this forum and the
>> > net
>> > over the past few days. I have a 2003 Server running with RS, SP1
>> > installed
>> > but I keep getting the error that the server saying ... "Failure
>> > sending
>> > mail: The Report Server has encountered a configuration error; more
>> > details
>> > in the log files" and the lof files show nothing other than the error
>> > that
>> > has been mentioned here several times ...
>> >
>> > ReportingServicesService!library!1678!01/07/2005-07:33:07:: i INFO:
>> > Call
>> > to
>> > RenderFirst( '/Sutter Connect/SC EDI/EDI Utilization Vendor Report' )
>> > ReportingServicesService!library!1678!01/07/2005-07:33:07:: e ERROR:
>> > Throwing
>> > Microsoft.ReportingServices.Diagnostics.Utilities.ServerConfigurationErrorException:
>> > The Report Server has encountered a configuration error; more details
>> > in
>> > the
>> > log files, AuthzInitializeContextFromSid: Win32 error: 1355;
>> > Info:
>> > Microsoft.ReportingServices.Diagnostics.Utilities.ServerConfigurationErrorException:
>> > The Report Server has encountered a configuration error; more details
>> > in
>> > the
>> > log files
>> >
>> > I have read through many KB articles, including 842423 and I can get it
>> > to
>> > send just the link as mentioned in that article. I have tried the fixes
>> > and
>> > installed the SP1 to no avail. I have reinstalled RS three times, using
>> > different accounts (Local Admin, two different service domain accounts)
>> > and
>> > nothing fixes the problem. I have the same issue on a test machine
>> > running
>> > 2000 Server. So I cannot get this feature to work.
>> >
>> > Can anyone help? Does anyone know how to get the beta SP2? I am willing
>> > to
>> > try anything. Thanks in advance.
>> >
>> > ~Shari
>>|||Did you get sp2 and did it solve the problem? (I'm having same trouble with RS SP1 on 2003 Server.)
--
Message posted via http://www.sqlmonster.com|||I worked this incident with Microsoft tried windows 2003 sp1 to no avail and then found an answer. They should be posting the new information in their kb and they are considering changes to the software to prevent this behavior.
To sum it up, the account that the report services is running as is having trouble checking some authorization attributes of the user that created the subscription. In my case my user account is in a different domain than the user account the sql reporting services is running as and my domain did not trust the domain of the sql reporting service account. So when the job tried to run that service account was not allowed to check an attribute in my domain for the account of the user that created the subscription. When the check fails it prevents the job from running and does not produce a very friendly error message. In my case I was able to create the 2 way trust relationship and it worked immediately.
MS's reason for doing this initially was so if an employee sets up a subscription to email himself corporate data and he quits or gets fired, they wanted to make sure his subscription stopped working once his account is disabled. I gave feedback that if an admin sets up production subscriptions and then leaves the company, you don't want your production systems to stop operating. They are reviewing the strategy and are considering not failing the job but rather just log warnings in the event log.
--
Message posted via http://www.sqlmonster.com|||More info: It seems the same process did not work for a Windows 2000
server, it seems the magic solution in our case was:
This worked:
Server 2003 SP1 (RC1)
Reporting Services SP1
RS Service domain trusted by subscription creator domain
This did not:
Server 2000 SP4
Reporting Services SP1
RS Service domain trusted by subscription creator domain
--
Message posted via http://www.sqlmonster.com

Monday, March 12, 2012

How to get rid of time in a date/time field?

I am using vb.net 2005 with crystal and I am wanting to only show the date on the record being grabbed from SQL. currently it is showing the date along with the time stamp. Is there an easy way to do this in Crystal?I figured it out...format object :-) Easy enough!

How to get rid of the Database Login window ?

Hi, I'm a newbie in VB.Net, need some help here. I'm generating a report and view it in a win app, which is in VB.Net. I've specified the database logon info by the following code:

*************************************************
Imports CrystalDecisions.CrystalReports.Engine
Imports CrystalDecisions.Shared

Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load

Dim crtableLogoninfo As New TableLogOnInfo()
Dim crConnectionInfo As New ConnectionInfo()
Dim CrTables As Tables
Dim CrTable As Table
Dim TableCounter
Dim crReportDocument As New cr1()
With crConnectionInfo
.ServerName = "mydb"
.UserID = "myuserid"
.Password = "mypassword"
End With

CrTables = crReportDocument.Database.Tables

For Each CrTable In CrTables
crtableLogoninfo = CrTable.LogOnInfo
crtableLogoninfo.ConnectionInfo = crConnectionInfo
CrTable.ApplyLogOnInfo(crtableLogoninfo)
Next

CrystalReportViewer1.ReportSource = crReportDocument

End Sub
*****************************************************

It's an Oracle DB and just one table, suppose to be very simple. But whenever the app starts, this "Database Login" window always opens first, asking for server info, db info, user name and password. Actually if I click "Cancel", the report still get generated. So how to get rid of this annoying "Database Login" window?

My second question is, how to automatically send this report to printer? I know in VB6 you just say action=1. Unfortunately this thing doesn't work in .Net any more.

Thanks!Just look through CrystalReport knowledgebase, seems that this is a known issue. Refer to this article:
http://support.businessobjects.com/library/kbase/articles/c2010461.asp

Is there already a fix for this ?|||Figured this out by carefully reading this article: http://support.businessobjects.com/library/kbase/articles/c2010461.asp

The Form_new method has to be overwritten, adding some customized initialization, where ser/uid/pass can be specified.

**** I just took it for granted to do it in Form_load...

Friday, March 9, 2012

How to get Primary Key (Columns) of a Table?

I want to get the Primary Key Columns in Arrays by sending a table
name. I am using SQL Server 2000 and I want to make a find utility in VB.net which
will work for all the forms; I have tables with one Primary key and some tables with composite Primary keys.

I used to do this in VB 6 by making a function which fills the Primary Keys in
List Box (I require to fill in list box), now I need to get in array.

Can some one tell me the migration of the following VB 6 Code?

This was written for the MS Access, I need same for SQL Server, I can
not find Table Def and Index Object in VB.net 2003.

Public Sub GetFieldsFromDatabase (ldbDatabase As Database, lsTableName As
String)

Dim lttabDef As TableDef
Dim liCounter As Integer
Dim liLoop As Integer
Dim idxLoop As Index
Dim fldLoop As Field

With ldbDatabase
For Each lttabDef In .TableDefs
If lttabDef.Name = lsTableName Then
liCounter = lttabDef.Fields.Count
For liLoop = 0 To liCounter - 1
cboFieldLists.List(liLoop) = lttabDef.Fields(liLoop).Name
Next liLoop
For Each idxLoop In lttabDef.Indexes
With idxLoop
lblIndexName = .Name
If .Primary Then
liCounter = 0
For Each fldLoop In .Fields
cboPrimaryKeys.List(liCounter) = fldLoop.Name
liCounter = liCounter + 1
Next fldLoop
End If
End With
Next
cboFieldLists.ListIndex = 0
If cboPrimaryKeys.ListCount > 0 Then
cboPrimaryKeys.ListIndex = 0
End If
Exit For
End If
Next
End With
End Sub

SQL Server has a built-in system stored procedure calledsp_primarykeys whichwill return you the primary key information for the table you specify.
USE master
EXEC sp_primarykeys @.table_server = N'LONDON1',
@.table_name = N'Customers',
@.table_catalog = N'Northwind',
@.table_schema = N'dbo'
|||Thanks TmortonSmile [:)]

Wednesday, March 7, 2012

How to get NTEXT data via SP to vb.net app?

i have a table with ntext field and i need to get some fields including the
ntext value to a vb.net application (vs2003)
i have this routine in vb:
Public Function GetMsgs2Email() As DataTable
Dim da As New SqlDataAdapter
Dim result As New DataTable
Try
cmdSelect.CommandText = "SP_name_here"
cmdSelect.CommandType = CommandType.StoredProcedure
da.SelectCommand = cmdSelect
da.Fill(result)
Return result
Catch ex As SqlException
EDTUtils.LogFiles.Log(ex)
Catch ex As Exception
EDTUtils.LogFiles.Log(ex)
End Try
Return Nothing
End Function
How to write the SP that will return as a result set the ntext value with
other fields?
any other techniques will do as well
thanks in advance
raficreate proc dbo.boo as
select ntext_field, someotherfield, anotherone
from dbo.sometable s
where s.somefield=somevalue
"Rafi" <Rafi@.discussions.microsoft.com> wrote in message
news:5BEDBDC2-D19C-4F03-BEFE-391CA4696768@.microsoft.com...
>i have a table with ntext field and i need to get some fields including the
> ntext value to a vb.net application (vs2003)
> i have this routine in vb:
> Public Function GetMsgs2Email() As DataTable
> Dim da As New SqlDataAdapter
> Dim result As New DataTable
> Try
> cmdSelect.CommandText = "SP_name_here"
> cmdSelect.CommandType = CommandType.StoredProcedure
> da.SelectCommand = cmdSelect
> da.Fill(result)
> Return result
> Catch ex As SqlException
> EDTUtils.LogFiles.Log(ex)
> Catch ex As Exception
> EDTUtils.LogFiles.Log(ex)
> End Try
> Return Nothing
> End Function
> How to write the SP that will return as a result set the ntext value with
> other fields?
> any other techniques will do as well
> thanks in advance
> rafi

Sunday, February 19, 2012

how to get host_name in .net programming for subscribers

Hi all...
While setting up my merge replication through the replication wizard in I
read that the use of HOST_NAME() in the dynamic filter returns the
Subscriber's Machine Name. How to get host_name() value in .net code can
anyone give or suggest the code
how to write to get host_name and where i have to use it . I already defined
the host_name in sql server under dynamic filter for merge replication.
I have 50 subscribers and 1 publisher. I use merge replication. The
distributor runs on publisher. The publisher and distributer server name is
creativesoft.How do I set the dynamic filter that every subscriber would get
only his data?
yours truly,
Pramod Renikindi,
creativesoft,
australia
system.dns.gethostname()
Hilary Cotter
Looking for a SQL Server replication book?
http://www.nwsu.com/0974973602.html
Looking for a FAQ on Indexing Services/SQL FTS
http://www.indexserverfaq.com
"pramod" <pramod@.discussions.microsoft.com> wrote in message
news:AE2A49CF-B76F-4719-9D60-984E9FB6D085@.microsoft.com...
> Hi all...
> While setting up my merge replication through the replication wizard in I
> read that the use of HOST_NAME() in the dynamic filter returns the
> Subscriber's Machine Name. How to get host_name() value in .net code can
> anyone give or suggest the code
> how to write to get host_name and where i have to use it . I already
defined
> the host_name in sql server under dynamic filter for merge replication.
> I have 50 subscribers and 1 publisher. I use merge replication. The
> distributor runs on publisher. The publisher and distributer server name
is
> creativesoft.How do I set the dynamic filter that every subscriber would
get
> only his data?
> --
> yours truly,
> Pramod Renikindi,
> creativesoft,
> australia

how to get fiels value in Code

Hello,
I wrote a function in vb.net and i Sent her parameter.
The function is used in a table cell.
I want the function to use a field value,
I tried :
Fileds!myFilesName.Value
But it didn't work.
Can I do this kind of thing?
Thanks.On Jul 1, 8:49 am, nicknack <roezo...@.gmail.com> wrote:
> Hello,
> I wrote a function in vb.net and i Sent her parameter.
> The function is used in a table cell.
> I want the function to use a field value,
> I tried :
> Fileds!myFilesName.Value
> But it didn't work.
> Can I do this kind of thing?
> Thanks.
I don't quite follow what you are requesting; however, to use a field
value from a report dataset, you would use an expression similar to
the following:
=Fields!FieldName.Value
If you are wanting to include custom code, you would utilize it in the
following way:
In the Layout view, select the Report drop-down menu. Select Report
Properties... Then select the Code tab and enter the code here.
Hopefully, this gives you a start.
Regards,
Enrique Martinez
Sr. Software Consultant|||Hi Martinez, Its look like I meet you on every question of mine (And I
am very glad for that :)
I'll will try to explain again:
I have a table in my report.
in one of the cells I have a filed. some thing like:
=Fields!FieldName.Value
Now, Let say I want to add him the value "2". I will use:
=Fields!FieldName.Value + 2
Now, let say that I want to call a function that will add him the
value "2" and return the result.
I can use the following call:
=Code.AddTwoFunction(Fields!FieldName.Value)
And in my code I will get the Filed value as parameter and add him the
2.
What I wanted to know is if I can call the function with out the
parameter and tell her to automaticlly get the value of the field from
the row she was called?
The reason I need this is that I have a function that need to get 5
fileds and when I call it it looks some thing like:
=Code.AddTwoFunction(Fields!FieldName.Value,Fields!
FieldName2.Value,Fields!FieldName3.Value,Fields!
FieldName4.Value,Fields!FieldName5.Value)
Hope I explain my self better.
Thanks again!
EMartinez :
> On Jul 1, 8:49 am, nicknack <roezo...@.gmail.com> wrote:
> > Hello,
> > I wrote a function in vb.net and i Sent her parameter.
> > The function is used in a table cell.
> > I want the function to use a field value,
> > I tried :
> > Fileds!myFilesName.Value
> >
> > But it didn't work.
> > Can I do this kind of thing?
> >
> > Thanks.
>
> I don't quite follow what you are requesting; however, to use a field
> value from a report dataset, you would use an expression similar to
> the following:
> =Fields!FieldName.Value
> If you are wanting to include custom code, you would utilize it in the
> following way:
> In the Layout view, select the Report drop-down menu. Select Report
> Properties... Then select the Code tab and enter the code here.
> Hopefully, this gives you a start.
> Regards,
> Enrique Martinez
> Sr. Software Consultant|||Hi,
On the similar lines, can I access other Report Items on the report namely
Line Object/Sub Report Object. I would like to read the Line Objects Vertical
position value or SubReports Height property.
Could you please help me on this.
Regards,
Sudhakara.T.P.
"nicknack" wrote:
> Hi Martinez, Its look like I meet you on every question of mine (And I
> am very glad for that :)
> I'll will try to explain again:
> I have a table in my report.
> in one of the cells I have a filed. some thing like:
> =Fields!FieldName.Value
> Now, Let say I want to add him the value "2". I will use:
> =Fields!FieldName.Value + 2
> Now, let say that I want to call a function that will add him the
> value "2" and return the result.
> I can use the following call:
> =Code.AddTwoFunction(Fields!FieldName.Value)
> And in my code I will get the Filed value as parameter and add him the
> 2.
> What I wanted to know is if I can call the function with out the
> parameter and tell her to automaticlly get the value of the field from
> the row she was called?
> The reason I need this is that I have a function that need to get 5
> fileds and when I call it it looks some thing like:
> =Code.AddTwoFunction(Fields!FieldName.Value,Fields!
> FieldName2.Value,Fields!FieldName3.Value,Fields!
> FieldName4.Value,Fields!FieldName5.Value)
> Hope I explain my self better.
> Thanks again!
> EMartinez :
> > On Jul 1, 8:49 am, nicknack <roezo...@.gmail.com> wrote:
> > > Hello,
> > > I wrote a function in vb.net and i Sent her parameter.
> > > The function is used in a table cell.
> > > I want the function to use a field value,
> > > I tried :
> > > Fileds!myFilesName.Value
> > >
> > > But it didn't work.
> > > Can I do this kind of thing?
> > >
> > > Thanks.
> >
> >
> > I don't quite follow what you are requesting; however, to use a field
> > value from a report dataset, you would use an expression similar to
> > the following:
> > =Fields!FieldName.Value
> > If you are wanting to include custom code, you would utilize it in the
> > following way:
> > In the Layout view, select the Report drop-down menu. Select Report
> > Properties... Then select the Code tab and enter the code here.
> > Hopefully, this gives you a start.
> >
> > Regards,
> >
> > Enrique Martinez
> > Sr. Software Consultant
>

How to get fields value in function

Hello,
I wrote a function in vb.net and i Sent her parameter.
The function is used in a table cell.
I want the function to use a field value,
I tried :
Fileds!myFilesName.Value

But it didn't work.
Can I do this kind of thing?

Thanks.

Instead of Fields!myFielsName.value it would be something like this for the expression:

=Code.YourFunctionName(Fields!myFieldName.Value)

Hoep this helps

|||Hi.
Thanks for the amswer.

I know how to call a function from my report with a value.

I'll will try to explain again:

I have a table in my report.

in one of the cells I have a filed. something like:

=Fields!FieldName.Value

Now, Let say I want to add him the value "2". I will use:

=Fields!FieldName.Value + 2

Now, let say that I want to call a function that will add him the
value "2" and return the result.

I can use the following call:

=Code.AddTwoFunction(Fields!FieldName.Value)

And in my code I will get the Filed value as parameter and add him the
2.

What I wanted to know is if I can call the function with out the
parameter and tell her to automaticlly get the value of the field from
the row she was called?

The reason I need this is that I have a function that need to get 5
fileds and when I call it it looks some thing like:

=Code.AddTwoFunction(Fields!FieldName.Value,Fields!
FieldName2.Value,Fields!FieldName3.Value,Fields!
FieldName4.Value,Fields!FieldName5.Value)

What I would like to do is to call the function from the cell like =Code.AddTwoFunc() and inside the function use something like:

dim str = Fields!FieldName.Value + 2;

The problem is that it doesn't recognize the"Fields!FieldName.Value"

Hope I explain my self better

How to get Extended error information from stored procedure

Hi

I have a stored procedure in SQL server 2005. It works fine when I execute it from the Management Studio.
But when executing it from ASP.NET code like this:

.... Of course more code is executed before this call ....
int retVal =this.odbcCreateDataBaseCommand.ExecuteNonQuery();

retVal is -1. But -1 doesn't really tell me what the problem is?

Is there anyway to get extended error information so I can figure out whats going wrong?

(The stored procedure was working fine in SQL server 2000 before I upgraded to SQL server 2005. I use .NET Framework 1.1 and ODBC Sql Native Client to access the 2005 server.)

Regards

Tomas

My own thought...
Maybe .NET Framework 1.1 and SQL Server 2005 and ODBC SQL Native Client have poor compatibility...

Anyone out there with experience/insight?

Thanks
Tomas