View Complete Post
I have several VB.NET functions which pass and receive values from executed stored procedures using parameters. However, the latest method I am using seems to be a little too specific on the datatype and data length of the parameters for my liking (i.e. LogActivityCommand.Parameters.Add("@strErrSource", SqlDbType.NVarChar, 300).Value = strErrSource). For example:
Public Function LogError(ByVal strErrSource As String, ByVal strErrCode As String, ByVal strErrDesc As String) As String Dim AerialConnection = New SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings("aerialConnectionString").ConnectionString) Dim RetVal As SqlParameter Try AerialConnection.Open() Dim LogActivityCommand = New SqlCommand("spLogError", AerialConnection) LogActivityCommand.CommandType = CommandType.StoredProcedure 'Add input parameters LogActivityCommand.Parameters.Add("@strErrSource", SqlDbType.NVarChar, 300).Value = strErrSource &
If the view state is the data entered into the form fields then they are supposed to be available in the request parameters or request body. Then why would we need view state for?
I've already solved this problem to my satisfaction, I just want to know WHY it works this way.
I have a FormView control bound to an ObjectDataSource. Let's say our data source is a hypothetical table with three columns: id, name, age. Why is it that when I use the <asp:Table> element inside of the FormView, the parameter values are not set, but when I use the standard <table> tag, it works fine?
This seems like a .NET problem to me. I expect the <asp:Table> element to work in the same way as <table> because they are, for all intents and purposes, the same thing. Am I missing something?
I'm currently getting to know the linqdatasource control. What would happen if several WHERE parameters are added to the linqdatasource control declaritively in the aspx page but no WHERE clause is defined?
1. is there any issue with setting up multiple WHERE parameters in the aspx markup for linqdatasource but then deciding which ones actually get used at runtime by setting the actual WHERE clause at run time? Would the unused parameters simply be ignored and cause no issues?
2. when you need to modify WHERE clause or WHERE parameters at runtime do you need to do so in an event handler? such as linqdatasource.selecting?http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.linqdatasource.selecting.aspxI see from the above link it is possible, but is that the standard way to handle controlling filtering in code behind for linqdatasource?
2b. if you use an event such as linqdatasource.selecting to add where parameters and/or modify the where clause in code will that also break the builtin sorting and paging support of the linqdatasource with a gridview?
I have two tables
Trans with fields TransID, Date, CustomerID and some other stuff
Customer with fields CustomerID, Name, TaxId
On the screen the user only sees the fields Date and Customer Name. CustomerID is behind the scenes only.
I'm using SqlDataSource. Having no problems with SelectCommand. I don't know how to construct the UpdateCommand and InsertCommand.
Let's say the user changes the date, then I need to do an UPDATE.
UPDATE Trans SET Date = @Date, CustomerID = @CustomerID results in an error message and the record is not updated.
I get an error on the page that says "Sys.WebForms.PageRequestManagerServerErrorException: Input string was not in correct format".
I tried taking out the set for CustomerID and I still get the error on page.
Also, for inserting, the users will see a dropdownlist with Customer Names. I need to convert that to a CustomerID to be used in the new record being inserted in the database. I'm not sure how to do this.
Do I need to do something with Control Parameters?
I've searched for several hours and haven't come up with a reference - or even many discussions - of how to go about validating Japanese names, addresses, etc. When I lived in Japan websites, atm's etc. required such info to be entered with the roman alphabet but I've seen some websites that are allowing Kanji/Hiragana/Katakana. I haven't tested many of them for validation but one that I did test (after looking at the page source and discovering no client-side validation) allowed me to put this in the name field: J*=123*go^ Neat!
Any pointers/references? Thanks
Windows Presentation Foundation has a rich data binding system that includes flexible support for business data validation. We take a look at implementing some complex data input validation scenarios that include customized data errors for users.
MSDN Magazine June 2010
MSDN Magazine May 2005
Office InfoPath 2003 is a new Microsoft Office product that lets you design your own data collection forms that, when submitted, turn the user-entered data into XML for any XML-supporting process to use. With an InfoPath solution in place, you can convert all those commonly used paper forms into Microsoft Office-based forms and end the cycle of handwriting and reentering data into your systems. Today organizations are beginning to realize the value of the mountains of data they collect every day, how hard it is to access it, and are striving to mine it effectively. InfoPath will aid in the design of effective data collection systems. Here the author shows you how to get started.
MSDN Magazine September 2003
I'm trying to teach myself MVC and have been having a few problems trying to handle a form input and post scenario. I am trying to have a section at the top for searching that appears on every page (like there is on sites like amazon).
I've read websites such as: http://weblogs.asp.net/scottgu/archive/2007/12/09/asp-net-mvc-framework-part-4-handling-form-edit-and-post-scenarios.aspx and tried to follow their example form post code in my Site.master file.
The problem I'm having is that it always calls the default controller action, regardless of what I put as the url in the form action (in fact, I can even remove the form tags altogether and it doesn't seem to make a difference -the text box will still call the default controller when I press enter).
In my site master file, I have tried the using the following html markup:
<form action="Home/SearchResults" method="post"> <input id="Search" type="text" name="searchText" /> <input type="submit" value="Search" />
which is the for
I'm on the edge wondering is it possible ? I have got 2 questions. Please help me out.
1. I have a GridView on my page and it uses sqldatasource with parameterized query. What I want to do is, on page load (where nothing has been selected so no parameter supplied), I want it to query everything (something like SELECT * FROM [this_table]) but since my SelectCommand is something like
SELECT * FROM [this_table] WHERE [this_column] = @someParameters AND [that_column] = @someParameters.
Can I play around with default value to achieve something like that but how ? Now, when the page loads, it doesn't show anything (No Gridview).
2. On my page, I made something like (username, gender, address, and more) and one single search button. That means, no single control enable auto postback. What I am trying to accomplish is building dynamic query
(if username specifed -> SELECT * FROM [this_table] WHERE [username] LIKE @username).
If both username and gender are specified (SELECT * FROM [this_table] WHERE [username] LIKE @username AND [gender] = @gender) and you know the rest. How can I do this using GridView and SqlDataSource ? To my knowledge, I can only specify one SELECT statement in a sqldatasource. I am stucked and desparately looking for help. Thanks all.