Friday, March 30, 2012
passing parameter from vb 6 to crystal report 8
.Reset
.ReportFileName = App.Path & "\reports\vaccine_flow_ledger.rpt"
.Connect = "Provider=MSDASQL.1;Persist Security Info=False;Data Source=APACCESS"
.DiscardSavedData = True
.ParameterFields(0) = "SDT;" & #1/7/2005#
.ParameterFields(1) = "EDT;" & #1/7/2005#
.Action = 1
End With
Please help me to resolve this problem.Try this
.ParameterFields(0) = "SDT;"# & 1/7/2005 & #"
.ParameterFields(1) = "EDT;"# & #1/7/2005& #"|||I tried that one,but i didn't work.
but
.parameterfields(0) = "sdt;" & "date(2005,1,1);"
works finesql
Passing output parameter from procedure to variable
varchar. I would like to use an output parameter to get the value and then
pass that value into a variable to use elsewhere. Is this possible?
ThanksSure.
Example:
use northwind
go
create procedure usp_get_companyname
@.customerid nchar(5),
@.companyname nvarchar(40) output
as
set nocount on
set @.companyname = (select companyname from customers where customerid =
@.customerid)
return @.@.error
go
declare @.cn nvarchar(40)
execute usp_get_companyname @.customerid = 'alfki', @.companyname = @.cn output
print @.cn
go
drop procedure usp_get_companyname
go
AMB
"Andy" wrote:
> I have a stored procedure that runs a query and the result of the query is
a
> varchar. I would like to use an output parameter to get the value and the
n
> pass that value into a variable to use elsewhere. Is this possible?
> Thanks|||Something like this?
use pubs
go
create proc first
@.au_lname varchar(50),
@.au_id varchar(11) OUTPUT
as
SELECT @.au_id = au_id from authors where au_lname = @.au_lname
RETURN (0)
GO
create proc second
@.au_id varchar(11)
as
select * from titleauthor where au_id = @.au_id
RETURN (0)
GO
declare @.lname varchar(50), @.id varchar(11)
set @.lname = 'white'
exec first @.lname, @.id output
select @.id
exec second @.id
go
declare @.lname varchar(50), @.id varchar(11)
set @.lname = 'green'
exec first @.lname, @.id output
select @.id
exec second @.id
go
drop proc first
drop proc second
Keith
"Andy" <Andy@.discussions.microsoft.com> wrote in message
news:0289E9D3-8AB3-481D-8869-92E6CFD12FF2@.microsoft.com...
> I have a stored procedure that runs a query and the result of the query is
a
> varchar. I would like to use an output parameter to get the value and
then
> pass that value into a variable to use elsewhere. Is this possible?
> Thanks
Passing NULL-value into package variables
We have a package with a package variable.
This variable is of data-type 'DateTime'.
However, when i try to pass the value 'NULL' the package fails... i use the following statement with 'dtexec.exe'
/SET \Package.Variables[MyDate].Value;"NULL"
What's the correct syntax for passing null-values? But maybe (because i cannot find anything on this) i should ask if this is even possible...
I don't think you can pass nulls through the commandline dtexec or dtexecui simply because a DBNull is an object. One option you can pursue is to pass it using a console app written in VB or C#.This link shows one of the ways of doing that.|||
Dennis_v_E wrote:
We have a package with a package variable.
This variable is of data-type 'DateTime'.
However, when i try to pass the value 'NULL' the package fails... i use the following statement with 'dtexec.exe'/SET \Package.Variables[MyDate].Value;"NULL"
What's the correct syntax for passing null-values? But maybe (because i cannot find anything on this) i should ask if this is even possible...
Its not possible.
One way around it may be to have a boolean variable called IsDatetimeNull which you set to TRUE or FALSE from the command-line.
Then, you put an expression on your datetime variable which sets it to NULL(DT_DBTIMESTAMP) if IsDatetimeNull==TRUE.
Something like that anyway. You get the idea.
-Jamie
|||
Thanx,
To bad it cannot be done simple. But i get the idea.
Maybe i put a feature request in Connect.
Dennis
sqlPassing null value parameter to a data-driven subscription
I have a data-driven subscription (DDS) stored procedure that gets called when a subscription fires and returns parameters to a report. One of the parameter values I want to return is NULL, which also happens to be the default value of the corresponding report parameter.
When I set the report parameter to use the default value (NULL) when setting up the subscription in Report Manager, the subscription works fine. When I try to pass the NULL value from the DDS proc to the report, the subscription fails.
I do not know what the error logs say. I've rarely looked at them and what I have seen seems a bit cryptic. I've narrowed down through trial-and-error that passing the NULL value is the issue.
Has anyone else experienced this issue and do you have a resolution?
Thanks in advance for your assistance.
I am having the same issue, please let me know if you have found a resolution.
Thank you,
Dave
|||
I had the same problem. In another thread someone mentioned that there is a problem with null parameters and data-driven subscriptions. It seems like a major bug in reporting services. My workaround was to use something other than null and have the report query recognize this setting as equivalent to null e.g. if it's a varchar field then set to 'NOTHING' and have the report definition query treat 'NOTHING' as NULL. For a uniqueidentifer field I used a guid with all zeroes.
Hope that helps.
Regards,
Greg
Passing null value parameter to a data-driven subscription
I have a data-driven subscription (DDS) stored procedure that gets called when a subscription fires and returns parameters to a report. One of the parameter values I want to return is NULL, which also happens to be the default value of the corresponding report parameter.
When I set the report parameter to use the default value (NULL) when setting up the subscription in Report Manager, the subscription works fine. When I try to pass the NULL value from the DDS proc to the report, the subscription fails.
I do not know what the error logs say. I've rarely looked at them and what I have seen seems a bit cryptic. I've narrowed down through trial-and-error that passing the NULL value is the issue.
Has anyone else experienced this issue and do you have a resolution?
Thanks in advance for your assistance.
I am having the same issue, please let me know if you have found a resolution.
Thank you,
Dave
Passing NULL value not working
I currently have a stored procedure that looks something like this
SELECT * FROM tblQuestions WHERE Title LIKE ISNULL('%'+@.Name+'%', Title)
I have a form that supplies this value. This statement should make it so that if a NULL value is passed in, then it will return all the rows, if some text is specified, then it will not. On my SQLDataSource on the page where the parameter is supplied I have set ConvertEmptyStringsToNull to True, but when I say in my code,
SqlDataSource1.SelectParameters.Add("@.Name", TextBox1.Text);
It won't give me back any of the rows, I know that the stored procedure works fine because I can get it to work by a basic query and other testing on it, so somewhere in my form, the NULL value isn't being passed, I belive that it is passing an empty string and I don't know why. Thank you in advance
/jcarver
Try this:
WHERE ([Title] Like '%' + @.Name + '%') or ( @.Name is NULL)"
And add this to your SqlDatasource: CancelSelectOnNullParameter="False"
|||The two where clauses are logically equivalent.
I'm a bit curious why you have a column called title and a parameter called @.name instead of @.title.
As for passing in a null, you could check the length of the textbox text, and if it's 0, send DBValue instead of the Text property.
|||
Try
IF @.Name IS NULL SET @.Name = ''
IF DATALENGTH(@.Name) > 0
SELECT * FROM tblQuestions WHERE Title LIKE '%'+@.Name+'%'
ELSE
SELECT * FROM tblQuestions
SELECT * FROM tblQuestions WHERE Title LIKE '%' + @.Name + '%'
ConvertEmptyStringToNull must be set to False!
sqlpassing null date value to database
Check out the DBNull class. :)|||DBNull.Value should do the trick ...
But don't forget when reading back from the table to check for the NULL value|||well, i tried that it says can't convert System.DBNull to datetime. i also used Convert.DBNull but it shows error at run time if the value isn't provided. well, it seems like i have to pass DBNull.Value directly but in my case i have to assign it to variable coz i am using stored procedure and using SqlHelper class.
what about integers though? is it the same thing?|||I think you should be able to use System.Data.SqlTypes.SqlDateTime.Null.
Terri|||hi terri,
it still says "value of type System.Data.SqlTypes.SqlDateTime.Null cannot be converted to 'Date'"|||Can you please post the relevant code?
Terri|||
Dim commDate As DateTimeIf tbCommDate.Text = "" Then
'commDate = New DateTime(1900, 1, 1)'can't use this statement
commDate = System.Data.SqlTypes.SqlDateTime.Null
Else
commDate = CType(tbCommDate.Text, DateTime)
End If
I pass this "commDate" to the stored procedure. i am using SQLHelper class.|||We need to also see the code where you are telling the SQLHelper class the data type of the commDate parameter.
Terri|||
Public Shared Function ProspectiveInsert(ByVal agentId As Integer, ByVal tripId As Integer, ByVal institution As String, ByVal nationality As String, ByVal title As String, ByVal dob As DateTime, ByVal sex As String, ByVal elicos As String, ByVal course1 As String, ByVal course2 As String, ByVal fname As String, ByVal mname As String, ByVal lname As String, ByVal osStud As Boolean, ByVal osAdd As String, ByVal osPhone As String, ByVal osMobile As String, ByVal osFax As String, ByVal osSuburb As String, ByVal osPostcode As String, ByVal osCity As String, ByVal osCountry As String, ByVal add As String, ByVal phone As String, ByVal mobile As String, ByVal fax As String, ByVal suburb As String, ByVal postcode As String, ByVal city As String, ByVal country As String, ByVal email As String, ByVal ugQual As String, ByVal ugIns As String, ByVal ugYear As String, ByVal seconQual As String, ByVal seconYear As Integer, ByVal seconIns As String, ByVal pgQual As String, ByVal pgIns As String, ByVal pgYear As Integer, ByVal appStatus As String, ByVal appNotes As String, ByVal appDate As String, ByVal ielts As Double, ByVal engRemarks As String, ByVal coeDate As DateTime, ByVal coeRemarks As String, ByVal offerDate As DateTime, ByVal offerRemarks As String, ByVal recAddDate As DateTime, ByVal prefCommDate As DateTime, ByVal notes As String, ByVal modBy As String) As IntegerTry
SqlHelper.ExecuteNonQuery(ConfigurationSettings.AppSettings("connectionString"), "MCS_ProspectiveStudentInsert", agentId, tripId, institution, nationality, title, dob, sex, elicos, course1, course2, fname, mname, lname, osStud, osAdd, osPhone, osMobile, osFax, osSuburb, osPostcode, osCity, osCountry, add, phone, mobile, fax, suburb, postcode, city, country, email, ugQual, ugIns, ugYear, seconQual, seconIns, seconYear, pgQual, pgIns, pgYear, appStatus, appNotes, appDate, ielts, engRemarks, coeDate, coeRemarks, offerDate, offerRemarks, recAddDate, prefCommDate, notes, modBy)
Catch ex As SqlException
Return ex.Number
End TryReturn 0
End Function
This is the function where I have passed the dates but i can't assign the System.Data.SqlTypes.Null to date variable.|||OK, I believe I have misled you. You should be using System.DBNull. Let us know if this works better for you.
Terri|||it says "DBNull is a type in system and can't be used as an expression."
at the moment i am using default value but i think that's not a good idea is it?|||thanx a lot for your time Terri.
i appreciate your willingness to help me.|||THe problem has NOTHING to do with SQL. See:
[code]
Dim commDate As DateTime
If tbCommDate.Text = "" Then
'commDate = New DateTime(1900, 1, 1)
'can't use this statement
commDate = System.Data.SqlTypes.SqlDateTime.Null
[/code]
NATURALLY blows. You can not assign SqlDateTime.Null to a DateTime.
You have to make the assignment "lower" - i.e. you pass the SqlDateTime directly into the relevant SQL parameter. You can not store it in another non-compatible time in the meantime.
For example, the EntityBroker - my O/R-Mapper - makes the switch statement directly when putting the value into the PARAMETER (or encoding the value for the SQL string). THEN it gets accepted (DBNull.Value, btw.). The way you do it earlier just results in an invalid cast.|||but i am using SqlHelper class. so i think i can't use it then. right?
Wednesday, March 28, 2012
Passing multivalued parameter from parent report to child report in Reporting service
I have report which accepts multi Value paramter in the Parent Report, this report has a drill down feature. but when i try passing the multi value parameter to the child report only the 1st value in the list is passed.
Parent Report accepts multiple users and based on which it shows the total % of issues submitted by thoses selected users in the multi value list. on drill down i need to send the user list again from the parent so that the child report shows each issue in detail. but when i use Parameters!Users.value i get only the 1st selected value.
could any one pls help me achive this requirement of mine.
thanks
Chandresh Soni
Are the data coming from Analysis Services or are they based on a relational data source?
For the relational case I recommend reading the following forum posting: http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=163803&SiteID=1
-- Robert
|||Yes the data in the first report was coming through relational database. and i had given a drill down feature in the first report which takes to the second report which shows the details information off the parameter(multivalued) selected from the first. it worked for me.
I appreciate yr help - Robert
Passing Multi-Value parameters to a Data Driven Subscription
Hi,
I've been asked to set up a data driven subscription for a number of reports which use multi value parameters. For example, show me all transactions against the following departments: IT, Building Services, Accounts.
As an interactive report it's simple, the user just selects the relevant departments, but as a data driven subscription I can't seem to find the correct format to pass the selections through.
Has anyone tried this before?
Thanks,
Dan
please search on "Multi-Value parameters to a Data Driven Subscription" in this forum.Passing multi value parameter to the Drill through report
Hi
I have two reports say Report A and Report B.
Both reports using same parameters.
I am Navigating from Report A to Report B using Jump to Report option.
Now when I pass multiple parameter to the Report B it only displays first parameter results.
In report B I have parameter multi value select to true.
I would like to know if its possible or not to pass multi value parameter in drill through report?
I would appreciate if someone can help me here.
Regards
Amit
Yes you can pass multi value parameters to a drill through report.
It works similar to multi value parameters for subreports, which is discussed in detail in this thread: http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=163803&SiteID=1
-- Robert
|||Thanks Rob.
That helped.
passing multi value parameter to stored procedure
I wrote a Stored Procedure spMultiValue which takes Multi Value String Parameter "Month". The stored procedure uses a function which returns a table. when I Execute the stored procedure from SQL Server 2005 with input "January,February,March" everything works fine.
In the dataset , I set command type as Text and typed the following statement.
EXEC spMultiValue " & Parameters!Month.Value &"
its not returning anything.
can anyone tell me how to pass multivalue parameter to stored procedure.
Thanks for your help.
Change the command type to Stored Procedure and type
SPMultiValue
Now click OK and hit the refresh button. Now go back to Edit the dataset and go to parameters tab and map it with the correct parameter.
For multi value parameter within stored procedure you need to decode the multi values to be able to use in the query.
|||Thanks for u'r reply. I have GroupDataBy parameter. Based on that value I need to call different stored procedure.
I have to use commond type As text. Is there any way to pass Multi value parameter for the following statement
"Exec spMultiValue '" & Parameters!Month.Value & "'"
|||Change Parameters!Month.Value to Parameters!Month.IsMultiValuePassing multi value parameter between reports
I've seen some theads on this but cant seem to get this right. Report A has 5 parameters 2 of them are multi value-- when I click on part of Report A I want to jump to report B and pass all parameter values from report A. The single value ones work but multi value only passes on value and not all values selected-- what am I missing here? Do I need to pass the values in the multi value parameters in an array?
thanks
k
Duuhhhh
someone definelty has a case of the mondays going-- changed =Parameters!code.Value(0) to =Parameters!code.Value
and all is well.
k
Passing Multi Value Delimited string to a parameter
I am using, or want to use a parameter as a filter in a sql statement, the
user will pick from a list that will then send a delimited list of numbers
e.g. "a1,a2,a3,a4" as the parameter that will be referenced in the sql
statement with a " field IN (@.parameter) " type thing.
Im sure this should work and its probably just the phrasing or something
that ive got wrong, can anyone help?
Steve DMulti-select parameters are a feature of RS 2005. This will not work in RS
2000. You can do dynamic sql to do this (note that you do open up to
injection attacks). Switch to generic query designer (to the right of the
...). Put in something like this.
="select somefield from sometable where anotherfield in (" &
Parameters.ParamName.Value & ")"
Note that RS will not detect your field list, so first have a regular query
to populate the field list.
Bruce Loehle-Conger
MVP SQL Server Reporting Services
"Steve Dearman" <steve.dearman@.grant.co.uk> wrote in message
news:OFZt89YWGHA.1564@.TK2MSFTNGP03.phx.gbl...
> Hi Everyone,
> I am using, or want to use a parameter as a filter in a sql statement, the
> user will pick from a list that will then send a delimited list of numbers
> e.g. "a1,a2,a3,a4" as the parameter that will be referenced in the sql
> statement with a " field IN (@.parameter) " type thing.
> Im sure this should work and its probably just the phrasing or something
> that ive got wrong, can anyone help?
> Steve D
>
Monday, March 26, 2012
Passing LinkButton text value as Sql Query parameter!
Hi,
Could you inform me programmatically how can I pass LinkButton text value as Sql Query parameter?
I tried the
1command.CommandText ="SELECT DISTINCT [Description] FROM [Projects] WHERE ([Type] = " & SqlDbType.Text = LinkButton12.Text &")"
but it does not work!!!
Thanks in advance!!!!Try changing the line to this:
command.CommandText = "SELECT DISTINCT [Description] FROM [Projects] WHERE ([Type] = '" & LinkButton12.Text & "')"The statement "SqlDbType.Text = LinkButton12.Text" probably evaluated to a boolean which threw off your query.|||Ok,thank you very much ZeroDefinition...
Passing Integer list to SQL using TableAdapter?
I want to select rows that have an integer value IN a parameter list value
I want to pass an integer list to my tableadapter's select
as in Select * from sometable
Where myIntValue IN (@.intParamList )
I cannot figure out how to get my list into @.intParamList
It works fine as a single value - eg 3, but how do I set it to 1,2,3 ?
Thanks
Bill
Hi,
I don't think you can't pass 1,2,3 as integer parameter according to my knowledge. Well you might have to change the parameter to varchar and it will work for you.
Thanks and best regards,
|||Thanks I got it.
The answer is to use a varchar list AND a Numbers table which allows me to Select the values without using IN
Googling SQL Numbers table gives several examples
Bill
Passing Index Value
In tblCatalogue there is all the information on catalogues.
In tblArticles there is all the information on articles.
There is a key between the articles table and the catalogues, that reflect which catalogue a specific article belongs in.
I am trying to add a new article and column at the same time in a stored procedure. If a new record is created in the Catalogue table can that KeyCol value then be passed into the Insert statement for the Article table? Would this be done with a "SELECT KeyCol FROM INSERTED" trigger on the Catalogue table? If so how do you trap that output in a variable to be passed to the article insert?
All help and comments are appreciated.I'm not clear on the relationship between articles and catalogs. Must an article be in a catalog? Can an article be in more than one catalog?
It would also help to know what database engine you are targeting (Db2, Oracle, MS-SQL, etc). This can influence many design choices.
-PatP|||Apologies. I am using MSSQL 2000. An article can only appear in one catalog and must appear in a catalog.
The key here is that I am calling a SP, usp_ins_Article. Passed into the SP are two values, ArticleName, and CatalogName. The stored procedure checks to see if the CatalogName exists and if not it calls usp_ins_Catalog, passing in the catalog name. Once that is complete I need to have the value of the KeyCol for the new record. This is then inserted into the table (tblArticles) as a foreign key along with the ArticleName.
What I am hoping for is to have the Catalog SP return the KeyCol value into a variable in the Articles SP.
I hope this makes sense, and thanks for your quick reply.|||If your insert stored procedure concocts the KeyCol value using code, just keep a copy. If it uses an IDENTITY column, recover the value using @.@.IDENTITY.
In both your CREATE PROCEDURE paramenter list and your EXECUTE parameter list for the insert procedure, include the OUTPUT modifier for a parameter to return the value to the caller.
That should get you on your way!
-PatP
Passing in Date Parameters
Create Procedure spTest as
@.DateFrom DateTime,
@.DateTo DateTime
/* Procedure Logic Not Shown */
GO
I'm trying to pass in a date generated from Functions.
EXECUTE spTest Month(GetDate()) + '/1/2003', '2/2/2003'
When I run the Stored Procedure I get an "error near Month" but when I hard code in a date things work fine. i.e. '1/1/2003'. Any ideas?From the code taht you presented to us, I see two problems:
1)
Create Procedure spTest as
@.DateFrom DateTime,
@.DateTo DateTime
/* Procedure Logic Not Shown */
GO
should be like this:
Create Procedure spTest @.DateFrom DateTime,
@.DateTo DateTime as
/* Procedure Logic Not Shown */
GO
but this one I think it's just a type error when you posted your question, because you said that the sp worked when you passed the parameters hardcoded. The sp would never work (and never compile) in the form mentioned in your post
2)
Instead of:
EXECUTE spTest Month(GetDate()) + '/1/2003', '2/2/2003'
I would use:
EXECUTE spTest '' & Month(GetDate()) & '/1/2003', '2/2/2003'
Good luck!
ionut calin|||EXECUTE spTest '' & Month(GetDate()) & '/1/2003', '2/2/2003'
I paired up the quotes and the above line doesn't seem to work. Also tried:
EXECUTE spTest '' & Month(GetDate()) & '/1/2003''', '2/2/2003'
EXECUTE spTest Month(GetDate()) & '/1/2003', '2/2/2003'
EXECUTE spTest Month(GetDate()) + '/1/2003', '2/2/2003'
Just in case it was a data conversion issue I tried the following as well.
EXECUTE spTest CONVERT(VARCHAR(2), Month(GetDate)) + '/1/2003', '9/1/2003'
passing in a value to use as a column 'as name' in a stored proc
I want to hand into a store procude the column name to use in the returned
result set...
create proc sample
@.colName as nvarcher(20)
as
select col1 as @.colname, col2 from table1..
But this produces an error... saying incorrect syntax near @.colname
is there a way to do want i am trying to do here?
ThanksThe curse and blessings of dynamic SQL
http://www.sommarskog.se/dynamic_sql.html
Martin C K Poon
Senior Analyst Programmer
====================================
"Aussie Rules" <AussieRules@.nospam.nospam> bl
news:uvQ1pgOjGHA.3572@.TK2MSFTNGP04.phx.gbl g...
> Hi,
> I want to hand into a store procude the column name to use in the returned
> result set...
> create proc sample
> @.colName as nvarcher(20)
> as
> select col1 as @.colname, col2 from table1..
> But this produces an error... saying incorrect syntax near @.colname
> is there a way to do want i am trying to do here?
> Thanks
>
>
>|||Thanks for Martin's informative inputs.
Hi Aussie,
I agree with Martin that you would need to consider using the dynamic SQL
execution. And in SQL Server the "exec" or "execute" keyword to execute
dynamic generated T-SQL statements:
#EXECUTE
http://msdn.microsoft.com/library/e...asp?frame=true
BTW, dynamic sql will have additional performance overhead comparing to
static T-SQL execution. Also, when we use string concatenate to generate
dynamic dynamic T-SQL statement, we would also take care of SQL injection
issue:
#SQL Injection
http://msdn2.microsoft.com/en-us/library/ms161953.aspx
Hope this also helps.
Regards,
Steven Cheng
Microsoft Online Community Support
========================================
==========
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
========================================
==========
This posting is provided "AS IS" with no warranties, and confers no rights.
Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)|||Hi Aussie,
Have you got any progress or new ideas on this issue or does our replies
help you some? If there is still anything we can help, please feel free to
post here.
Regards,
Steven Cheng
Microsoft MSDN Online Support Lead
========================================
==========
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
========================================
==========
This posting is provided "AS IS" with no warranties, and confers no rights.
Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
Passing Formula as a parameter to SQL Query in AddCommand
I'am new to Crystal reports,
I created a formula based on that i have to fetch column value from database
for that i wrote a very simple query in SQLCOMMAND
as SELECT <TABLE.CPLUMN> FROM <TABLE>
WHERE <TABLE.OTHERCOLUMN>='@.CRYSTAL REPORT FORMULA'
when closing the commandbox i'am getting error "OLE DB ERROR NO DATABSE RECORDS FOUND"
if i pass a some hardcoded vale(data whic exists in database) then the query is not throwing any error..
Thanks
MikeI don't think you can do that. You can create and use parameters in you query but not formulas. Your query looks really simple, so I have some doubts if it was that necessary to create it in your case.
Why don't you use something like that:
if {TABLE.OTHERCOLUMN}>=here print what you have in your '@.CRYSTAL REPORT FORMULA' then {TABLE.OTHERCOLUMN}
This formula does the same.
Friday, March 23, 2012
Passing DDL value to bit field in SQL
sqlcommand.Parameters.Add(New SqlParameter("@.fld", SqlDbType.Bit, 1))
sqlcommandl.Parameters("@.fld").Value = System.Boolean.Parse(DropDownList1.SelectedValue)
or
sqlcommand.Parameters.Add(New SqlParameter("@.fld", SqlDbType.Bit, 1))
sqlcommandl.Parameters("@.fld").Value = System.Convert.ToBoolean(DropDownList1.SelectedValue)
to insert the selected value in a sql2k database BIT field I am given this error:
System.FormatException: String was not recognized as a valid Boolean.
How can I solve this problem?
// C# but you should get the idea
bool trueFalse = false;
if( DropDownList1.SelectedValue.Value.Equals("1") ){
trueFalse = true;
}
sqlcommandl.Parameters("@.fld").Value = trueFalse;