Showing posts with label form. Show all posts
Showing posts with label form. Show all posts

Thursday, March 29, 2012

Can I Insert/Update Large Text Field To Database Without Bulk Insert?

I have a web form with a text field that needs to take in as much as the user decides to type and insert it into an nvarchar(max) field in the database behind. I've tried using the new .write() method in my update statement, but it cuts off the text after a while. Is there a way to insert/update in SQL 2005 this without resorting to Bulk Insert? It bloats the transaction log and turning the logging off requires a call to sp_dboptions (or a straight-up ALTER DATABASE), which I'd like to avoid if I can.

You can't just use a plain old update statement and set the column = a parameter of the correct datatype?

|||

How do you indicate that a SqlParameter is of type nvarchar(max)? Any numeric length up to 4000 is easy, but beyond that I've come up empty.

|||

When I add a parameter to a command, I use the AddWithValue method instead of the Add method. That way I don't have to type in the datatype and the length, I just pass it text and it works.

It's possible that it will truncate on you using that method, but I've used it with ntext and long text values before

|||

cmd.Parameters.Add("@.Blobby",SqlDbType.Nvarchar)

or

cmd.Parameters.Add("@.Blobby",SqlDbType.Nvarchar,-1)

|||

cmd.Parameters.AddWithValue("@.Blobby",myTextBox.Text)

(or any other object's value instead of myTextBox)

|||

I normally don't recommend AddWithValue because it can cause some problems when it's unclear what the conversions (if any) should be. This comes into play when the result to be passed could possibly be a nvarchar or a more specific data type (integers, dates). Under certain circumstances, .NET decides to send the data to SQL Server as a nvarchar, and when it gets there, it realizes that it needs to be converted to a more specific data type, but the information needed to do the conversion correctly (because of culture formatting) isn't available on the server, or it uses the servers culture rather than the culture of the running page.

Using .Add with a specified datatype insures that the data conversion is done by .NET before sending the parameter on to SQL Server.

Can I have SQL server clear a value after a certain amount of time?

I have an application that allows users to "reserve" a certain time and location for practice sessions. I want them to look at a web form that shows which times are available and then allows them to select an open slot and then submit this form with some personal information. My problem is that as soon as they select an open slot, other users should see that this slot is no longer available. On the other hand, if someone selects an open slot and then takes too long to type in their personal information, I want it somehow to kick them out and re-open this slot back up.

I know that I can create a field called 'status' in my database that gets turn to something like 'pending' as soon as the first user clicks on an open slot, but how would I turn this field back to the 'open' state if the user took too long to enter their data?

Any help would be surely appreciated.

Cheers,
AzFyou can store the time the page was requsted in some variable and check against some preset time like 5 min or 10 min...also when do you set the slot as reserved...as soon as the user clicks on the spot or at the end of the page after the user finished entering all the info...? i would suggest doing the latter...

hth

Tuesday, March 20, 2012

Can I change the text on the "View Report" button?

SSRS 2005
In the web form Report Viewer Control, is there a simple way to change the
text that appears on the "View Report" button?
I would like to either shorten the text or have it appear on two lines to
minimize the page width taken up by this button.
-- Chris
--
Chris, SSSIHello Chris,
As for the ReportViewer Control's "ViewButton", based on my research, it is
encapsulated as an "ViewReportButton" class which is an internal Type. I've
tried reference to this button instance from ReportViewer control's
Controls collection and change it Text, but that didn't work. I think it is
internally assigned the "View Report" text value. Actually since
Reportviewer is a well encapsulated webcontrol, there hasn't much options
for us to customize its individual settigns.
So far what I can get are the following two options if we want to provide a
custom parameterArea or button:
1. Still use the ReportViewer's built-in parameterArea and
ViewReportButton, however, we can only change the button's text by using
clent-side script(find the submit button and change its value), e.g:
==========================<script language="javascript">
function AdjustViewButton()
{
var div = document.getElementById("ReportViewer1");
elems = form1.getElementsByTagName("INPUT");
var i;
for(i=0;i<elems.length;i++)
{
if(elems[i].type == "submit" && elems[i].value == "View Report")
{
elems[i].value = "View";
}
}
}
.........................
<body onload="AdjustViewButton();" >
...............
=============================
2. Do not use the built-in parametersArea of the ReportViewer control(hide
it by setting ShowParameterPrompt=false), and provide our own UI(like label
and textbox ) to accept parameters from user, also add our own View Report
Button, and in the button's click event, we need to use custom code to add
parameters into ReportViewr.serverReport's parameters collection and render
the report.
Hope this helps some. If you have any other ideas, please feel free to let
me know.
Sincerely,
Steven Cheng
Microsoft MSDN Online Support Lead
==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.
Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.|||Hello Chris,
How are you doing on this issue, have you got any further idea or does my
last reply helps you a little? If there is any other information you
wonder, please feel free to let me know.
Sincerely,
Steven Cheng
Microsoft MSDN Online Support Lead
This posting is provided "AS IS" with no warranties, and confers no rights.|||Hi Steven,
Thank you for your reply and suggestions. It is not what I wanted to hear
;-) but I understand your proposals.
It would be nice if Microsoft could provide the ability to do such simple
customization through properties, etc. in the future.
It seems that the out of the box SRSS offering gets you going very quickly,
but very soon you also run into limitations and have to write custom code. It
is of course great that such custom code solutions are possible (it is very
flexible), but it also minimizes the productivity gains to be obtained with
SRSS. Just my 2 cents. ;-)
-- Chris
Chris, SSSI
"Steven Cheng[MSFT]" wrote:
> Hello Chris,
> How are you doing on this issue, have you got any further idea or does my
> last reply helps you a little? If there is any other information you
> wonder, please feel free to let me know.
> Sincerely,
> Steven Cheng
> Microsoft MSDN Online Support Lead
>
> This posting is provided "AS IS" with no warranties, and confers no rights.
>|||Thanks for your followup Chris,
Yes, I can understand your concern here since what you want to customize is
just a simple Text property of the Button and it will be much more
convenient if the ReportViewer control has provide such a property for
modify it directly.
Fortunately the ReportViewer control still provide some programmtic
approach here as workaround. Also, since this is the first version of the
component, the dev team may haven't considered all the possible scenarios.
So please trust me, our dev guys will surely improve it for sequential
release(also the reporting services) according to more and more community
user experience and feedback. Thus, any of your feedback and comments are
really important to us.
Please feel free to post your comments and request so that our product team
can hear more on such feature request:
http://connect.microsoft.com/feedback/default.aspx?SiteID=210
Again thanks for your posting and understanding!
Sincerely,
Steven Cheng
Microsoft MSDN Online Support Lead
This posting is provided "AS IS" with no warranties, and confers no rights.

Thursday, March 8, 2012

Can create access form layout based on table from sql?

Hi,

Can this be done? Please advise. Thanks.Is there any template available in sql for creating forms?

YOu will have to use any coding language for this like the .NET language. If you are aware of that, which platform will you use for accessing the data (Windows Forms, Web Forms, etc.). SQL Server does ot provide such a feature beside the table editor.


HTH, Jens K. Suessmeyer.


http://www.sqlserver2005.de

Tuesday, February 14, 2012

Can a dataset in reporting services return multiple datatables

Hi.

I am trying to access data from a stored procedure that returns data in form of multiple data tables. But when i drop this stored procedure in my rdl report, it just shows me the first data table returned by stored procedure.

I want to know that is there any way that I can view all the data tables returned by my stored procedure, or this is not possible in reporting services 2005.

This is not supported by SSRS 2005. You may be able make this work programatically i.e. build your own component to process multipe result sets.