Thursday, March 22, 2012
Can't find how to add a line feed to a textbox
I'm creating a report with a textbox that contains a field from the dataset
and some hard text (something like =First(Fields!MyField.Value) & "
TheTextPart"). This works, but when I try to do a shift+enter (line feed) I
get an error "The value expresxsion for the textbox 'textbox7' contains an
error: [BC30648] String constants must end with a double quote".
Is there any way to add a line feed / carriage return in a text box?
Thanks!
Ricktry this:
=First(Fields!MyField.Value) & vbcrlf & "The Second Line" & vbcrlf &
"The Third Line"|||Brilliant! Thanks Sleepy!
"SleepyLab" <david.blancard@.fairmont.com> wrote in message
news:1187036726.406106.312410@.d55g2000hsg.googlegroups.com...
> try this:
> =First(Fields!MyField.Value) & vbcrlf & "The Second Line" & vbcrlf &
> "The Third Line"
>
Tuesday, March 20, 2012
Cant enable SQLCacheDependency
I have a SQL 2005 database and am running the 2.0 framework. I cannot seem to enable SQL caching on the db. I'm using the command line tool as follows:
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727>aspnet_regsql -S 99.99.999.999 -U
webteam -P sa -t tblname -d dbname -et
Enabling the table for SQL cache dependency.
.An error has happened. Details of the exception:
The database 'dbname' is not enabled for SQL cache notification
.
To enable a database for SQL cache notification, please use the System.Web.Cachi
ng.SqlCacheDependencyAdmin.EnableNotifications method, or the command line tool
aspnet_regsql. To use the tool, please run 'aspnet_regsql.exe -?' for more infor
mation.
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727>
I've replaced the ip address, dbname and tblname with ficticious names for obvious reasons here in the post.
What command can I enter to enable the database for caching?
Hi,
As show on the error message, you have to enable the cache notification on the whole database, using SqlCacheDependencyAdmin.EnableNotifications() method.
I can reproduce the error on my machine. And after calling this method, aspnet_regsql works fine.
HTH. If anything is unclear, please feel free to mark this post as Not Answered and post your reply. Thanks!
|||Kevin, I'n not sure how to use the method you described. I tried to execute it from the command line as follows, but didn't work. It looks like I need to apply it in a .net program...
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727>SqlCacheDependencyAdmin.EnableNotifications(Data Source=99.99.999.999;Initial Catalog=dbname;UserID=id;Password=pswd)
'SqlCacheDependencyAdmin.EnableNotifications' is not recognized as an internal or external command,operable program or batch file.
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727>
How should I apply this method. Thanks so much...
|||Kevin, I'n not sure how to use the method you described. I tried to execute it from the command line as follows, but didn't work. It looks like I need to apply it in a .net program...
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727>SqlCacheDependencyAdmin.EnableNotifications(Data Source=99.99.999.999;Initial Catalog=dbname;UserID=id;Password=pswd)
'SqlCacheDependencyAdmin.EnableNotifications' is not recognized as an internal or external command,operable program or batch file.
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727>
How should I apply this method. Thanks so much...
|||Hi wsyeager,
This code is not executed from command line. It's a C# code.
You can create a project and execute this in the Form.Load event handler for a trial.
sqlSaturday, February 25, 2012
Cant convert record to integer
Hi All
I'm getting an error that says that this can't be converted to an integer.
Here is the line that gets the error.dt = ((DataView)(EventDataSource1.Select(dssa))).ToTable()
I have also tried. dt = (DataView)(EventDataSource1.Select(dssa);
I am programming in VB
here is teh rest of my code.
Dim EventDataSource1 As New SqlDataSource()
EventDataSource1.ConnectionString = ConfigurationManager.ConnectionStrings("ASPNETDBConnectionString").ToString
Dim dssa As New DataSourceSelectArguments()
Dim EventID As String = ""
Dim DataView = ""
Dim dt As New Data.DataTable
Dim conn As New Data.SqlClient.SqlConnection(ConfigurationManager.ConnectionStrings("ASPNETDBConnectionString").ToString())
Dim cmd As New Data.SqlClient.SqlCommand("SELECT EventID FROM Event WHERE ([StartDate] = @.StartDate)", conn)
EventDataSource1.SelectCommand = ("SELECT EventID FROM Event WHERE ([StartDate] = @.StartDate)")
conn.Open()
dt = ((DataView)(EventDataSource1.Select(dssa))).ToTable()
EventID = dt.Rows(0)(0).ToString()
EventDataSource1.SelectParameters.Add("@.StartDate",StartDate)
EventID = cmd.ExecuteScalar()
Seems like you overdoing it. If all you want is the first row, first column value...try something like this.
Dim EventIDAs String =""Dim connAs New Data.SqlClient.SqlConnection("Connection String")Dim cmdAs New Data.SqlClient.SqlCommand("SELECT EventID FROM Event WHERE ([StartDate] = @.StartDate)", conn)'add parameters cmd.Parameters.Add(New SqlClient.SqlParameter("@.StartDate","01/01/2007"))'open connections cmd.Connection.Open()'get top row and column EventID = cmd.ExecuteScalar()'close connection cmd.Connection.Close()'clean up conn =Nothing cmd =Nothing |||
That's all? Wow thanks!!
Just out of interest, what would I change if I didn't want the first column?
Thanks
|||here is a sample,Dim EventIDAs String Dim drAs SqlDataReaderDim connAs New Data.SqlClient.SqlConnection("Connection String")Dim cmdAs New Data.SqlClient.SqlCommand("SELECT EventID FROM Event WHERE ([StartDate] = @.StartDate)", conn)'add parameters cmd.Parameters.Add(New SqlClient.SqlParameter("@.StartDate","01/01/2007"))'open connections cmd.Connection.Open()'get entire dataset dr = cmd.ExecuteReaderWhile dr.Read()If IsDBNull(dr.Item("EventID")) =False Then EventID = (dr.Item("EventID"))End If'do whatever you want witht the dataEnd While'close dr dr.Close()'close connection cmd.Connection.Close()'clean up conn =Nothing cmd =Nothing just remember to close the reader.|||Thanks again. Everything works great! YEEE HAAA!!!!