Wednesday, March 28, 2012

Utterly strange performance in the Entity Framework

Hello!

I'm trying the new Entity framework and I must say that I observe an utterly strange performance result. Is there a way to submit my solution for investigation at Microsoft?

Best regards,

Henrik Dahl

Hi Henrik,

Please briefly describe your scenario and the expected result and send me the solution for investigation to nvalluri at microsoft dot com.

regards,


Naveen Valluri,

I've now submitted the stuff to you.

Do you think you have a chance to look at it in short time - I'm really looking forward hearing from you?

Best regards,

Henrik Dahl


Naveen Valluri,

Have you managed to observe the same amazing consumption of computational resources when running the solution?

Best regards,

Henrik Dahl


Sorry for the delay in response. Naveen is actually out sick today. We'll try to connect with him and get back to you as soon as we can. Given that I don't have the details of your situation, I can't speak to it, but I will say that one of the things we are working on during this development milestone is a significant push for performance improvements... The difference in beta 3 should be really noticeable for some scenarios.

- Danny


Hello Danny!

OK.

I imagine Naveen will be sick for only a few days. I may easily wait for that and let him to recover in peace!

It sounds good with significant performance improvements. In the current case it took multiple hours to insert a singular row in a singular table so I think that here there's really room for multiple orders of magnitude of performance improvements.

Despite it's not really the subject of this thread, do you know of a rough estimation of availability of beta 3, is it for instance assumed to be released during the year of 2007?

Best regards,

Henrik Dahl


The intention is to line up beta 3 of the EF with Orcas RTM. So, yes, we intend that it will ship sometime before the end of this calendar year, but of course there are lots of things that could change between now and then.

- Danny


Daniel,

Yes, it's obvious, but thank you for sharing this.

I look forward hearing from Naveen as he'll be back again.

Best regards,

Henrik Dahl


Hi Henrik,

Thanks for your patience. We did observe the delay in inserting the record for the first time and this is in part because the framework compiles the model files. Any queries, inserts or updates after that is in sub-second range. In the current milestone, we have been working on improving the performance in this area. We tried your scenarios against our latest bits, which you will see delivered as part of Beta 3 in late November and the performance has significantly improved. The time to compile the model files is reduced to 20 seconds. Again, to reiterate, this is only the first time that CRUD operation goes to the server . Even for this, we are working towards making this happen during design time, so that the cost isn’t there at runtime.

Thanks,

Naveen


Given that view compilation is the source of the problem, you can also pre-compile your views even in beta 2, and then you will have a big hit during this initial step, but at runtime that hit will go away. I've been meaning to write a blog post on how to do that, but haven't gotten to it yet. Suddenly I feel motivated--now if only I could get the time to do it... The clue I'll give you now is to look at the commandline options on edmgen where there's a generateviews or something like that. This will output code that is a compiled version of the views which the EF uses for queries and updates. You can compile that into your assembly, and then things should get much faster at runtime.

- Danny

Utterly strange performance in the Entity Framework

Hello!

I'm trying the new Entity framework and I must say that I observe an utterly strange performance result. Is there a way to submit my solution for investigation at Microsoft?

Best regards,

Henrik Dahl

Hi Henrik,

Please briefly describe your scenario and the expected result and send me the solution for investigation to nvalluri at microsoft dot com.

regards,


Naveen Valluri,

I've now submitted the stuff to you.

Do you think you have a chance to look at it in short time - I'm really looking forward hearing from you?

Best regards,

Henrik Dahl


Naveen Valluri,

Have you managed to observe the same amazing consumption of computational resources when running the solution?

Best regards,

Henrik Dahl


Sorry for the delay in response. Naveen is actually out sick today. We'll try to connect with him and get back to you as soon as we can. Given that I don't have the details of your situation, I can't speak to it, but I will say that one of the things we are working on during this development milestone is a significant push for performance improvements... The difference in beta 3 should be really noticeable for some scenarios.

- Danny


Hello Danny!

OK.

I imagine Naveen will be sick for only a few days. I may easily wait for that and let him to recover in peace!

It sounds good with significant performance improvements. In the current case it took multiple hours to insert a singular row in a singular table so I think that here there's really room for multiple orders of magnitude of performance improvements.

Despite it's not really the subject of this thread, do you know of a rough estimation of availability of beta 3, is it for instance assumed to be released during the year of 2007?

Best regards,

Henrik Dahl


The intention is to line up beta 3 of the EF with Orcas RTM. So, yes, we intend that it will ship sometime before the end of this calendar year, but of course there are lots of things that could change between now and then.

- Danny


Daniel,

Yes, it's obvious, but thank you for sharing this.

I look forward hearing from Naveen as he'll be back again.

Best regards,

Henrik Dahl


Hi Henrik,

Thanks for your patience. We did observe the delay in inserting the record for the first time and this is in part because the framework compiles the model files. Any queries, inserts or updates after that is in sub-second range. In the current milestone, we have been working on improving the performance in this area. We tried your scenarios against our latest bits, which you will see delivered as part of Beta 3 in late November and the performance has significantly improved. The time to compile the model files is reduced to 20 seconds. Again, to reiterate, this is only the first time that CRUD operation goes to the server . Even for this, we are working towards making this happen during design time, so that the cost isn’t there at runtime.

Thanks,

Naveen


Given that view compilation is the source of the problem, you can also pre-compile your views even in beta 2, and then you will have a big hit during this initial step, but at runtime that hit will go away. I've been meaning to write a blog post on how to do that, but haven't gotten to it yet. Suddenly I feel motivated--now if only I could get the time to do it... The clue I'll give you now is to look at the commandline options on edmgen where there's a generateviews or something like that. This will output code that is a compiled version of the views which the EF uses for queries and updates. You can compile that into your assembly, and then things should get much faster at runtime.

- Danny

Utterly strange performance in the Entity Framework

Hello!

I'm trying the new Entity framework and I must say that I observe an utterly strange performance result. Is there a way to submit my solution for investigation at Microsoft?

Best regards,

Henrik Dahl

Hi Henrik,

Please briefly describe your scenario and the expected result and send me the solution for investigation to nvalluri at microsoft dot com.

regards,


Naveen Valluri,

I've now submitted the stuff to you.

Do you think you have a chance to look at it in short time - I'm really looking forward hearing from you?

Best regards,

Henrik Dahl


Naveen Valluri,

Have you managed to observe the same amazing consumption of computational resources when running the solution?

Best regards,

Henrik Dahl


Sorry for the delay in response. Naveen is actually out sick today. We'll try to connect with him and get back to you as soon as we can. Given that I don't have the details of your situation, I can't speak to it, but I will say that one of the things we are working on during this development milestone is a significant push for performance improvements... The difference in beta 3 should be really noticeable for some scenarios.

- Danny


Hello Danny!

OK.

I imagine Naveen will be sick for only a few days. I may easily wait for that and let him to recover in peace!

It sounds good with significant performance improvements. In the current case it took multiple hours to insert a singular row in a singular table so I think that here there's really room for multiple orders of magnitude of performance improvements.

Despite it's not really the subject of this thread, do you know of a rough estimation of availability of beta 3, is it for instance assumed to be released during the year of 2007?

Best regards,

Henrik Dahl


The intention is to line up beta 3 of the EF with Orcas RTM. So, yes, we intend that it will ship sometime before the end of this calendar year, but of course there are lots of things that could change between now and then.

- Danny


Daniel,

Yes, it's obvious, but thank you for sharing this.

I look forward hearing from Naveen as he'll be back again.

Best regards,

Henrik Dahl


Hi Henrik,

Thanks for your patience. We did observe the delay in inserting the record for the first time and this is in part because the framework compiles the model files. Any queries, inserts or updates after that is in sub-second range. In the current milestone, we have been working on improving the performance in this area. We tried your scenarios against our latest bits, which you will see delivered as part of Beta 3 in late November and the performance has significantly improved. The time to compile the model files is reduced to 20 seconds. Again, to reiterate, this is only the first time that CRUD operation goes to the server . Even for this, we are working towards making this happen during design time, so that the cost isn’t there at runtime.

Thanks,

Naveen


Given that view compilation is the source of the problem, you can also pre-compile your views even in beta 2, and then you will have a big hit during this initial step, but at runtime that hit will go away. I've been meaning to write a blog post on how to do that, but haven't gotten to it yet. Suddenly I feel motivated--now if only I could get the time to do it... The clue I'll give you now is to look at the commandline options on edmgen where there's a generateviews or something like that. This will output code that is a compiled version of the views which the EF uses for queries and updates. You can compile that into your assembly, and then things should get much faster at runtime.

- Danny

V$session : Session not Closed

I connect to Oracle DB thru JDBC. I used CLIENT_INFO field in V$SESSION to store my intranet Application's User Name along with Username.
I controlled the user access thru checking that field. I assumed even if user goes out of that page, session will be closed automatically. But one of client went to other page by mistaken. He restarted the IE as well his own machine. But still the session is not closed. I can see the session in V$session.
Any idea whether such problems are preventable. i cannot even close that session from my machine. How to close that session.
Thank you in advance..Note that you probably want to address JDBC questions to the JDBC forum rather than the ODBC forum-- different protocols, different products.
Justin

v1.1 - datagrid - naming headers

hi,

I have had to create a bunch of field names in my table as (i.e) "20071225" (for 25-dec-2007).

But in my datagrid I want "25-dec-2007" as my column headers.

How would i achieve this?

Thanks,

John

I've answered my own question in case anyone else was interested.

I wanted to change my "col" (foreach(DataColumn colin dt.Columns) )

- where col.ColumnName.ToString() = "20071225"

I ended up changing the DataTable column names and then the bind to the Datagrid simply picked them up correctly.

-------

string stopval = col.ColumnName.ToString();

string year = stopval.Substring(0, 4);

string month = stopval.Substring(4, 2);

string day = stopval.Substring(6, 2);

// extra faffing to get MON

dtme = Convert.ToDateTime(day + "-" + month + "-" + year);

string strMonth = dtme.ToString("MMM");

col.ColumnName = day + "-" + strMonth + "-" + year;

--------

- now col.ColumnName.ToString() = "25-Dec-2007"

V8.16 returns error message upon opening database.

When opening a database using V8.16 support files and drivers the following error message is returned. "ODBC - Tunnel Error ORA-01456: may not perform insert/delete/update operation inside a READ ONLY transaction.
This error does not occur using V8.15.
What is the cause of this problem?You don't by any chance have the 'connect in read-only mode' option checked on your DSN do you?
Justin Cave

Vague error on data source - hard to debug

I have this error:

Server Error in '/247 Website' Application.

A field or property with the name 'armAreaName' was not found on the selected data source.

I have several data sources, any ideas if I can find outwhichdata source is at error here?

Look at your code. It will be the one that tries to reference a field called armAreaName.


Ok fair enough, I found it in my code eventually. I find its difficult to find the error working in design mode so I switched to code mode. However it would be nice if the error specified at least the datasource which was falling over.

Thanks anyway.


Design Mode has very few practical uses. Drag and drop and double click for event handlers is about it. It's definitely not the place to be when trying to debug runtime errors.

Valid Access Query Creates Empty Table using OleDbCommand?

I have a very simple query which runs through the Northwind customers table and extracts all CustomerIDs who live in a city starting with 'P'. It works great if I double-click on it in Access, but when I run it through my VB code, an empty table is created. Any idea what is going on?

Here is the very simple query text, which works well in MS Access, called 'MyQuery':

SELECT DISTINCT Customers.CustomerID, Customers.City INTO pCityCustomerIDs
FROM Customers
WHERE (((Customers.City) Like "P*"));

Here is my very simple VB Code:

Public Function ExecuteProcedure(ByVal sFileLocation As String) As Integer

Dim dcMSAccessConnection As OleDb.OleDbConnection = New OleDb.OleDbConnection( _

"Provider= Microsoft.Jet.OLEDB.4.0;Data Source=" & sFileLocation)

Dim myCmd As New OleDb.OleDbCommand

myCmd.CommandText = "MyQuery"

myCmd.CommandType = CommandType.StoredProcedure

myCmd.Connection = dcMSAccessConnection

Dim rowsAffected As Integer

' Open Connection, run the query, then close the connection

dcMSAccessConnection.Open()

rowsAffected = myCmd.ExecuteNonQuery

dcMSAccessConnection.Close()

Return rowsAffected

End Function


Under ADO (Jet OLEDB) the wildcard character is a percent sign. The asterisk is specific to DAO and Microsoft Access.

SELECT DISTINCT Customers.CustomerID, Customers.City INTO pCityCustomerIDs
FROM Customers
WHERE (((Customers.City) Like "P%"));


try with:

myCmd.ExecuteReader


Thanks Paul,

The devil is in the details.

Validaiton Control

Anyone knows how to add validation controls to the GridView fields when one click on edit?Add the validators within the EditItemTemplates, as in this demo:http://www.webswapp.com/codesamples/aspnet20/dropdownlist_gridview/default.aspx
Care to explain? Thks

Valida an XML file

I'd like to validate an xml file against an Schema and 3 tables (As lookups)
online from my database. I am thinkning to return an structure like a
dataset from a webserivce and then try to load the xml into the dataset
offline and show the user the errors? Dose this appraoch work?
Thanks a lotThe XmlValidatingReader can be used for this purpose, provided you have an
XSD to run against. Another validation option is running the XML through and
XSL doc.
--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA
***************************
Think Outside the Box!
***************************
"J-T" wrote:
> I'd like to validate an xml file against an Schema and 3 tables (As lookups)
> online from my database. I am thinkning to return an structure like a
> dataset from a webserivce and then try to load the xml into the dataset
> offline and show the user the errors? Dose this appraoch work?
>
> Thanks a lot
>
>
But where should I keep the data of my lookup tables? That's why I was
thinking of a container like dataset.
Thanks
"Cowboy (Gregory A. Beamer) - MVP" <NoSpamMgbworld@.comcast.netNoSpamM> wrote
in message news:286533D1-EF64-4A20-8F55-FA5709DF92B4@.microsoft.com...
> The XmlValidatingReader can be used for this purpose, provided you have an
> XSD to run against. Another validation option is running the XML through
> and
> XSL doc.
> --
> Gregory A. Beamer
> MVP; MCP: +I, SE, SD, DBA
> ***************************
> Think Outside the Box!
> ***************************
>
> "J-T" wrote:
>> I'd like to validate an xml file against an Schema and 3 tables (As
>> lookups)
>> online from my database. I am thinkning to return an structure like a
>> dataset from a webserivce and then try to load the xml into the dataset
>> offline and show the user the errors? Dose this appraoch work?
>>
>> Thanks a lot
>>
JT.
At first sight, "Why not?, however don't forget to write the schema.
\\\
ds.WriteXml("path",XmlWriteMode.WriteSchema)
///
I hope this helps.
Cor
So you mean that I can get whatever I want from the webserivce and dump it
into the client machines(Schema + Data) and from then onwrads the client can
work offline and also to be able to connect from while to while and get the
latest schema and data,right?
Thanks
"Cor Ligthert [MVP]" <notmyfirstname@.planet.nl> wrote in message
news:esXfEN9nFHA.764@.TK2MSFTNGP14.phx.gbl...
> JT.
> At first sight, "Why not?, however don't forget to write the schema.
> \\\
> ds.WriteXml("path",XmlWriteMode.WriteSchema)
> ///
> I hope this helps.
> Cor
>

Validate a CSV file

I have a CSV file which contains comma seperated data that I need to
validate against our database.I was thinking about loading that CSV file
into a Typed-Dataset which has our database schema in it and then try to
load the CSV file into that Typed-Dataset and automatically get all the
errors and constarint violations.
1) Is it doable?
2) Because I need to check the foriegn keys as well,Can I loaded the data of
those refferecing tables into my dataset as well?
3)If number 2 is doable ,how should I update my dataset if a key has been
added to the existing refferncing tables?
Thanks a lot for taking your time answering this post in advance.
J-TI suggest using BCP to upload it to a work table and doing the INSERTs from
a SP into a clone of the target table (just schema). When the INSERT
completes, the data is validated and can safely be inserted into the working
table. Then all you have to worry about is the RI issues.
--
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant
Microsoft MVP
www.betav.com/blog/billva
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________
"J-T" <J-T@.nospam.com> wrote in message
news:uEyAI7ukFHA.3756@.TK2MSFTNGP15.phx.gbl...
>I have a CSV file which contains comma seperated data that I need to
>validate against our database.I was thinking about loading that CSV file
>into a Typed-Dataset which has our database schema in it and then try to
>load the CSV file into that Typed-Dataset and automatically get all the
>errors and constarint violations.
> 1) Is it doable?
> 2) Because I need to check the foriegn keys as well,Can I loaded the data
> of those refferecing tables into my dataset as well?
> 3)If number 2 is doable ,how should I update my dataset if a key has been
> added to the existing refferncing tables?
>
> Thanks a lot for taking your time answering this post in advance.
> J-T
>
I'm exactly doing this using a DTS package ,but I'd like to give my user the
ability to validate his file using our web application.Now they upload their
files to our system through web application and then using DTS packages we
process them and report them back all the errors in their file ,ofcourse in
DTS we have buiness rules and stuff like that but here I'd like to give my
user the ability to make sure that his file is not malformed,has the
appropriate number of columns,and just validate the CSV file rather than
validation and applying business rules.
Thanks
"William (Bill) Vaughn" <billvaRemoveThis@.nwlink.com> wrote in message
news:OHpXZZvkFHA.3580@.TK2MSFTNGP09.phx.gbl...
>I suggest using BCP to upload it to a work table and doing the INSERTs from
>a SP into a clone of the target table (just schema). When the INSERT
>completes, the data is validated and can safely be inserted into the
>working table. Then all you have to worry about is the RI issues.
> --
> ____________________________________
> William (Bill) Vaughn
> Author, Mentor, Consultant
> Microsoft MVP
> www.betav.com/blog/billva
> www.betav.com
> Please reply only to the newsgroup so that others can benefit.
> This posting is provided "AS IS" with no warranties, and confers no
> rights.
> __________________________________
> "J-T" <J-T@.nospam.com> wrote in message
> news:uEyAI7ukFHA.3756@.TK2MSFTNGP15.phx.gbl...
>>I have a CSV file which contains comma seperated data that I need to
>>validate against our database.I was thinking about loading that CSV file
>>into a Typed-Dataset which has our database schema in it and then try to
>>load the CSV file into that Typed-Dataset and automatically get all the
>>errors and constarint violations.
>> 1) Is it doable?
>> 2) Because I need to check the foriegn keys as well,Can I loaded the data
>> of those refferecing tables into my dataset as well?
>> 3)If number 2 is doable ,how should I update my dataset if a key has been
>> added to the existing refferncing tables?
>>
>> Thanks a lot for taking your time answering this post in advance.
>> J-T
>
This validation step is where I normally use a csv parser like the one
I happen to sell, http://www.csvreader.com . This way on a row by row
basis, I can run all kinds of validation code, even possibly save the
good results out to another csv file to upload using the DTS package.
That's what I would recommend. I've also in this process mapped
multiple input column names with the same meaning, ie. Qty, Count,
Quantity, etc, to one resulting output column that matched my database
table's column name. You could load the data into a typed dataset if
that will work, but if you're only dealing with one fk constraint, I'd
be more likely to select out just the list of pk's, and then on a row
by row basis, do like a hash lookup to see if it's defined as one of
the pk's. This should give you better performance than loading all the
csv data up into the dataset, and then letting the dataset constraints
give you the errors, which from my experience isn't actually that nice
performancewise.
J-T wrote:
> I'm exactly doing this using a DTS package ,but I'd like to give my user the
> ability to validate his file using our web application.Now they upload their
> files to our system through web application and then using DTS packages we
> process them and report them back all the errors in their file ,ofcourse in
> DTS we have buiness rules and stuff like that but here I'd like to give my
> user the ability to make sure that his file is not malformed,has the
> appropriate number of columns,and just validate the CSV file rather than
> validation and applying business rules.
> Thanks
> "William (Bill) Vaughn" <billvaRemoveThis@.nwlink.com> wrote in message
> news:OHpXZZvkFHA.3580@.TK2MSFTNGP09.phx.gbl...
> >I suggest using BCP to upload it to a work table and doing the INSERTs from
> >a SP into a clone of the target table (just schema). When the INSERT
> >completes, the data is validated and can safely be inserted into the
> >working table. Then all you have to worry about is the RI issues.
> >
> > --
> > ____________________________________
> > William (Bill) Vaughn
> > Author, Mentor, Consultant
> > Microsoft MVP
> > www.betav.com/blog/billva
> > www.betav.com
> > Please reply only to the newsgroup so that others can benefit.
> > This posting is provided "AS IS" with no warranties, and confers no
> > rights.
> > __________________________________
> >
> > "J-T" <J-T@.nospam.com> wrote in message
> > news:uEyAI7ukFHA.3756@.TK2MSFTNGP15.phx.gbl...
> >>I have a CSV file which contains comma seperated data that I need to
> >>validate against our database.I was thinking about loading that CSV file
> >>into a Typed-Dataset which has our database schema in it and then try to
> >>load the CSV file into that Typed-Dataset and automatically get all the
> >>errors and constarint violations.
> >>
> >> 1) Is it doable?
> >>
> >> 2) Because I need to check the foriegn keys as well,Can I loaded the data
> >> of those refferecing tables into my dataset as well?
> >>
> >> 3)If number 2 is doable ,how should I update my dataset if a key has been
> >> added to the existing refferncing tables?
> >>
> >>
> >> Thanks a lot for taking your time answering this post in advance.
> >>
> >> J-T
> >>
> >
> >
Thanks for your reply,
>> but if you're only dealing with one fk constraint
No In my CSV file there are 33 columns which 20 of it would be foriegn key
lookups.
I cannot afford buyinh that product ,is there something free around?
Thanks again
"shriop" <shriop@.hotmail.com> wrote in message
news:1122522664.804866.161650@.f14g2000cwb.googlegroups.com...
> This validation step is where I normally use a csv parser like the one
> I happen to sell, http://www.csvreader.com . This way on a row by row
> basis, I can run all kinds of validation code, even possibly save the
> good results out to another csv file to upload using the DTS package.
> That's what I would recommend. I've also in this process mapped
> multiple input column names with the same meaning, ie. Qty, Count,
> Quantity, etc, to one resulting output column that matched my database
> table's column name. You could load the data into a typed dataset if
> that will work, but if you're only dealing with one fk constraint, I'd
> be more likely to select out just the list of pk's, and then on a row
> by row basis, do like a hash lookup to see if it's defined as one of
> the pk's. This should give you better performance than loading all the
> csv data up into the dataset, and then letting the dataset constraints
> give you the errors, which from my experience isn't actually that nice
> performancewise.
> J-T wrote:
>> I'm exactly doing this using a DTS package ,but I'd like to give my user
>> the
>> ability to validate his file using our web application.Now they upload
>> their
>> files to our system through web application and then using DTS packages
>> we
>> process them and report them back all the errors in their file ,ofcourse
>> in
>> DTS we have buiness rules and stuff like that but here I'd like to give
>> my
>> user the ability to make sure that his file is not malformed,has the
>> appropriate number of columns,and just validate the CSV file rather than
>> validation and applying business rules.
>> Thanks
>> "William (Bill) Vaughn" <billvaRemoveThis@.nwlink.com> wrote in message
>> news:OHpXZZvkFHA.3580@.TK2MSFTNGP09.phx.gbl...
>> >I suggest using BCP to upload it to a work table and doing the INSERTs
>> >from
>> >a SP into a clone of the target table (just schema). When the INSERT
>> >completes, the data is validated and can safely be inserted into the
>> >working table. Then all you have to worry about is the RI issues.
>> >
>> > --
>> > ____________________________________
>> > William (Bill) Vaughn
>> > Author, Mentor, Consultant
>> > Microsoft MVP
>> > www.betav.com/blog/billva
>> > www.betav.com
>> > Please reply only to the newsgroup so that others can benefit.
>> > This posting is provided "AS IS" with no warranties, and confers no
>> > rights.
>> > __________________________________
>> >
>> > "J-T" <J-T@.nospam.com> wrote in message
>> > news:uEyAI7ukFHA.3756@.TK2MSFTNGP15.phx.gbl...
>> >>I have a CSV file which contains comma seperated data that I need to
>> >>validate against our database.I was thinking about loading that CSV
>> >>file
>> >>into a Typed-Dataset which has our database schema in it and then try
>> >>to
>> >>load the CSV file into that Typed-Dataset and automatically get all the
>> >>errors and constarint violations.
>> >>
>> >> 1) Is it doable?
>> >>
>> >> 2) Because I need to check the foriegn keys as well,Can I loaded the
>> >> data
>> >> of those refferecing tables into my dataset as well?
>> >>
>> >> 3)If number 2 is doable ,how should I update my dataset if a key has
>> >> been
>> >> added to the existing refferncing tables?
>> >>
>> >>
>> >> Thanks a lot for taking your time answering this post in advance.
>> >>
>> >> J-T
>> >>
>> >
>> >
>

Validate a field

I have a very simple question.

I want to validate a textbox field by using the requiredfieldvalidator.

but that should only happen when i click on a particular button and not all the buttons.

i have a textbox for search and i don't want any blank values in that box so using validator, but i want to use the other buttons on the page.

pls help

Easily remedied :)

First set the validator's 'ValidationGroup' property to something that describes your validation. Eg. 'Search'

Then set the button's 'ValidationGroup' property to the same thing as the validator's so that it will fire only the validator you have defined.


Thanks a lot.....

validate a value from a textbox column in dataGrid

I have a datagrid which has three columns and one is a textBox templateColumn Quantity. I want to validate the value entered by the user in this column... ...is there a way I can validate the value. the other two columns get their value from the Xml file..so the textbox column is the only one where a user enter the value.

Thanks for your help
Neelayu can use validator control. if i need to do that, i just open the page in HTML format and type the necessary code with ControlToValidate property set to the control for which the validator is to be used.

validate boundfield before inserting into database

Hi,

i am trying to validate that the user has entered "http://" in a textbox boundfield control before saving to the database.

this is what i have:

TextBox txt = (TextBox)FormView1.FindControl("additionalInformationTextBox");
if (txt.Text.IndexOf("http://") == -1)
{
txt.Text = txt.Text.Insert(0, "http://");
}

now i want this new version to be saved in the database. I tried the
FormView1_ItemInserting and AccessDataSourceAddNewWord_Inserting events but they are not adding the updated version of the link into the database.

thanks for the help
john

This works for Updating and inserting event handler..

protectedvoid ObjectDataSource1_Updating(object sender,ObjectDataSourceMethodEventArgs e)

{

//change things before the pipe returns the object to the update method.

//grab my object

DbTableEntity d = (DbTableEntity)e.InputParameters[0];

if (!((TextBox)GridView1.Rows[GridView1.EditIndex].FindControl("tbRetDate")).Text.Length.Equals(0))

{

d.RetireDate =DateTime.Parse(((TextBox)GridView1.Rows[GridView1.EditIndex].FindControl("tbRetDate")).Text);

}

}

Validate Datagrid inputs?

I'm trying to validate data when updating a datagrid.

I'm using a RegularExpressionValidator and a Validiationsummary.
In this case I fist tried to create the Validator in code at runtime but I couldn't get it to work!

Then I took a RegularExpressionValidator control from the toolbox and set the errorMessage and ControlToValidate properties in the code, and tried to get the control to validate from the update code:


TextBox tbtel;
tbtel = (TextBox)(e.Item.Cells[3].Controls[0]);

RegularExpressionValidator2.ControlToValidate="tbtel"; //error!!
RegularExpressionValidator2.ErrorMessage="Wrong format!";
RegularExpressionValidator2.Validate();

This didn't work!

How do I validate a control like this, that is created "in code" at runtime?
I think that it has something to do with the ID of the control!?
How do I get the ID?

It works when I have a default Textbox and validates it !
But then the validiationSummaryControl.messagebox won't get executed until I press update twise or presses a button with no code behind!?
I think it has something to do with updating the page...

Code:


TextBox tbtel;
tbtel = (TextBox)(e.Item.Cells[3].Controls[0]);
TextBox1.Text=tbtel.Text;

RegularExpressionValidator2.ControlToValidate="TextBox1";
RegularExpressionValidator2.ErrorMessage="Wrong format!";
RegularExpressionValidator2.Validate();

Is there an easy way to do this??

/Regards
AndersAs far as I know, you cannot validate datagrid inputs.

Validate Data in SQL table

I have a form that the user enters values on it. One of the fields I need to
validate what is being entered against records in a SQL table.
Something like doing a findfirst in Access and then doing a nomatch.
How do I go about doing this?
Thanks In Advance,
LouU¿ytkownik "Lou Civitella" <lou@.webersystems.com> napisa³ w wiadomo¶ci
news:ewjBafHuEHA.2300@.TK2MSFTNGP09.phx.gbl...
>I have a form that the user enters values on it. One of the fields I need
>to
> validate what is being entered against records in a SQL table.
> Something like doing a findfirst in Access and then doing a nomatch.
> How do I go about doing this?
Create command (text or stored proc) that will check data in SQL Table.
Regards,
Grzegorz
Hi Lou,
Change the textbox to a combobox; then load the data from the table into the
combobox and the user can only pick valid data, by definition.
HTH,
Bernie Yaeger
"Lou Civitella" <lou@.webersystems.com> wrote in message
news:ewjBafHuEHA.2300@.TK2MSFTNGP09.phx.gbl...
>I have a form that the user enters values on it. One of the fields I need
>to
> validate what is being entered against records in a SQL table.
> Something like doing a findfirst in Access and then doing a nomatch.
> How do I go about doing this?
> Thanks In Advance,
> Lou
>

Validate data in GridView cell (while editing)

Hi,

Have someone any suggestions how to validate data that user write in GridView cell while editing it,
or even allow him to write only proper characters.

In my gridview user in some cells should only write numbers {1,3,9} in other {1,2,3,4,5}. How to check if he write numbers correctly?

Add the validators to the template field which will control the validatation of the input. For examle,

<EditItemTemplate>
<asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("ProductName") %>' Visible = false></asp:TextBox>
<asp:RequiredFieldValidator runat="server" ControlToValidate = "TextBox1" ErrorMessage="RequiredFieldValidator">
</asp:RequiredFieldValidator>
</EditItemTemplate>


For custom validator:http://www.asp.net/QuickStart/aspnet/doc/validation/default.aspx


Thanks

Validate Details View

Is it possible to validate text fields with in a Details View. Do I need to to it in the Template editor? if so how?

Hi nhaas:

<asp:RequiredFieldValidator ID="RequiredFieldValidator2"
ValidationGroup="InitiateJobEdit"
ControlToValidate="DropDownList1"
InitialValue="0" Text="(select one)" Runat="Server" /
in the EditItemTemplate source

And call Page.Validator in your update event.


Thanks I will try it in the morning!

Validate ddl selection on page load event?

User's previos ddl selection is saved and then attempting to select it for them on page load. What to do if selection no longer exists - msgbox in page load seems like something that should not be done. How can I notify user that their selection no longer exists so the ddl selection is being reset to default?What about using a label to display the error message? Set the Label Visible property to False in the designer, then if the selection no longer exists in Page_Load, set the Label Visible property to True. If you are wanting to present an error message in a popup dialog similar to MsgBox, that requires client-side code.

Validate FCKeditor input for maximum characters

I need to validate input for maximum characters into a FCKeditor textbox. I've seen this question, and variations on it, posted all over the place but haven't come across any clean solutions. Off the top of my head I can think of only two approaches:

1. Do some server side validation for maximum characters and return an error message if entered > max OR

2. Truncate the entry so as not to exceed the SQL Server column size and just caption the text box.

#2 is fine with me though I don't know how to go about doing it. I would much rather do the #1 method. Can anyone suggest how I may get this done?

Thanks

OnSubmit or whenever you want to do your check:

if ( FCKEditor.value.length > maxLength){ e.Cancel =true; lblError.Text ="Your value input is too long, please edit it by removing " + FCKEditor.value.length - maxlength +" characters from your input."; lblError.Visible =true; }