ADO.NET :: Timestamp Wrongly Treated By LINQ / ASP As String
Feb 12, 2011
I was following a MSDN walkthrough [URL] which is a very simple ASP.NET example with Visual Studio 2010:
·
I have a simple database table with a timestamp column;
·
I created a "Linq to SQL Class", and drag the table from Server Explorer onto it;
·
I dragged a LinqDataSource onto the web page and pointed it to the dbml;
·
I dragged a DetailsView onto the web page using the LinqDataSource.
·
I enabled editing on the data source.
When I run, the time stamp column is also displayed on the DetailsView as something like "AAAAAAAAB9Y=". Then, when I change the "EmployeeName" and update, I got following exception: Failed to set one or more properties on type person. Cannot convert value of parameter 'tstamp' from 'System.String' to 'System.Data.Linq.Binary'. I was strictly following the MSDN walkthrough. I tried multiple times, I even installed Visual Studio 2010 SP1 Beta. But it consistently through this exception. Can someone shed some light on this? Not a encouraging start form someone thinking to learn the lastest Microsoft stuff!
I was following a MSDN walkthrough, which is a very simple ASP.NET website with Visual Studio 2010: I have a simple database table with a timestamp column;I created a "Linq to SQL Class", and drag the table from Server Explorer onto it;I dragged a LinqDataSource onto the web page and pointed it to the dbml;I dragged a DetailsView onto the web page using the LinqDataSource.I enabled editing on the data source.When I run, the time stamp column is also displayed on the DetailsView as something like "AAAAAAAAB9Y=".Then, when I change the "EmployeeName" and update, I got following exception: Failed to set one or more properties on type person. Cannot convert value of parameter 'tstamp' from 'System.String' to 'System.Data.Linq.Binary'. I was strictly following the MSDN walkthrough. Can someone shed some light on this? Not a encouraging start form someone thinking to learn the lastest Microsoft stuff!dfsaf
View 1 Replies
Similar Messages:
Mar 29, 2010
I added a column of type "timestamp" to a table in SQL Server to use for concurrency control. I deleted all my tables from the Linq surface and then added them back. I see that the "Time Stamp" attribute is set to True for the timestamp column and False for all the other columns. I also see that the "Update Check" attribute is set to Never for all columns, including the timestamp column.
After watching some demo videos and reading some tutorials, I had expected to have to manually set the "Update Check" attribute values on the columns - to Never for all columns but the timestamnp column where it should be set to Always. But, before setting the "Update Check" to Always on the timestamp column, I decided to test it the way it was, and Linq seems to be doing the right thing - it seems to be using the timestamp column for concurrency control correctly even with "Update Check" set to Never on the timestamp column.
So my question is - does the fact that "Time Stamp" is set to True trump the "Update Check"? Or is there any other reason one could or should set "Update Check" to Always on a timestamp column? Is there any change in behavior?
View 2 Replies
Oct 21, 2010
I have a Timestamp column in my Table. I want to read the date time value and display in UI.
In Linq the Timestamp column is represented as System.Data.Linq.Binary.
I dont know how to retirve date time value in "MM-dd-YYYY" format from this Linq.Binary
- Why I am using Timestamp?.
I want to perform some operations based on the last modified date time of the particular row. Since I am using TimeStamp column in my Table as version column, It will contain the last modified date details, So i want to read the date time value from this time stamp column to do some other operations.
View 5 Replies
Dec 9, 2010
I have a column (data type timestamp) in SQL Server 2008.Now I want to show this timestamp value in ASP.Net C# app as string. Is there any way to do that?I tried it using regular data fetching in ASP.Net but it produced System.byte[] as output rather than actual value. In SQL Server Management Studio values are represented as 0x000000000000B3C0
View 2 Replies
Jan 10, 2011
This problem is trivial to duplicate. Do any query on a table which contains a timestamp / rowversion column. Set a breakpoint and examine the resulting query in the Linq to SQL visualizer. Click on Execute which displays the results in a DataGridView. For each row you get "System Argument Exception: Parameter is not valid" when it tries to display the timestamp / rowversion in the grid. What is most annoying is that there is no way to get out of the visualizer without going to Task Manager and killing the Visual Studio process, devenv.exe.
This is definitely a bug. How can you presume to be able to display a database query when you can't display an essential datatype like timestamp / rowversion? Is there any way around this ? I would like to add that in general the CLR is woefully inadequate in the way it handles timestamp / rowversion fields. It would be nice if they could be defined, copied, compared, displayed and serialized in some standardized automatic way.
View 3 Replies
Sep 13, 2010
I have a gridview with checkbox column. I loop through all the rows of gridview, if it's checked I enter the second column text into my database. The second column text at one point shows the word Küche, but when I take that text (in order to insert it in db) it gives me Küche and that's what I see when I then read it from db.
View 4 Replies
Jul 21, 2010
I'm attempting to configure a webdav server example application [URL] to run on IIS6 (Win2003 Server). The application runs correctly on my dev machine (Win7, IIS7.5). When I attempt to map a drive to the DAV share, several requests are issued, including one OPTIONS request and two PROPFIND requests. In Fiddler, I see that these are transmitted correctly. However, the response is always the content of the default page on the site. If I look at the IIS logs, the requests are logged as GETs instead of OPTIONS or PROPFIND. UrlScan is disabled, but I went ahead and added OPTIONS and PROPFIND to the list of allowed verbs (since I'm running out of ideas).
View 1 Replies
Aug 13, 2010
I have an MHTML file which has embedded images. The MHTML is generated on the server and then I will typically deliver the file using a BinaryWrite. I've also tried Server.Transfer, Response.Write after converting to ASCII and writing the file to disk and using a Response.WriteFile. In any of these cases the resulting file is not (it appears) treated as an mht file. For setting the image, I've tried Content-ID and Content-Location. The image URL shows up as cid:example1 when viewed in IE8. When opening up the file after saving to disk it shows up as mhtml:file://C:Documents and Settings enjynitoDesktopoutput634172401776447258.mht!cid:example1. Or while browsing with one of the methods that work you get [URL]
The Output.MimeType is message/rfc822. I've also tried application/octet-stream and multipart/related. Writing the file to disk and using a Response.Redirect works. Accessing the file with a direct URL works. Saving the file to disk and then opening the file works. It seems IE is assuming an HTML result to the request and not deciphering the new content type. But you can do things like this for dynamic style sheets, scripts, etc... so I don't really believe that. I couldn't see any glaring differences. I just tried and the BinaryWrite works fine in Opera. If I absolutely have to worry about writing to a temporary directory and then redirecting to the file I will. I was just hoping to avoid having to clean up the temporary files. Is what I want to do not possible? An example of writing the file is below.
if (response != null && response.Output != null)
{
Response.Clear();
Response.AddHeader("Content-Type", response.Output.MimeType);
Response.AddHeader("Content-Disposition", "attachment;filename=output" + DateTime.UtcNow.Ticks.ToString(CultureInfo.InvariantCulture) + "." + response.Output.Extension);
// Response.Write( System.Text.Encoding.ASCII.GetString(response.Output.Bytes));
Response.BinaryWrite(response.Output.Bytes);
//Response.Clear();
//Server.Transfer("/ISV/Forms/Test/output634172397522707394.mht");
//Response.Clear();
//Response.WriteFile( Server.MapPath("/ISV/Forms/Test/output634172397522707394.mht"));
Response.Flush();
Response.End();
View 1 Replies
Jan 12, 2010
I am little bit confuse with Asp.net MVC Area.
When we talk about WebForms we say, for Administrative tasks, you must have an Admin folder to separate the admin task.
In MVC how i will treat my Admin tasks?
I will go for Admin Area or Admin Controllers,
Because if i will write controller for Admin tasks, each and every task will be written in one controller (AdminController) or if i will write Area -> Controller, means i will need to write at-least two controllers for each feature.
Second if we breaks the application in Areas (as modules) how i will manage Admin task for each Area.
View 1 Replies
Dec 9, 2010
I've got a details view control, default set to Insert which I've added file upload controls. I've used a button to begin the upload process and add the other data to the database. The weird thing is that if I use FireFox to enter the data and upload the files, everything works fine but it works slightly differently in IE8. The difference is that when I browse for a file in FireFox, upload it and store the file name, it returns just the file name e.g. myPic.jpg. However, when I upload with IE8 it stores the entire route to the file e.g. C:/Users/Users/Site/myPic.jpg Why would a browser treat these things differently? And, is there a way to fix it to work on both browsers?
View 2 Replies
Apr 15, 2010
I have managed to expose the MEX endpoint of my WCF service and I can access it with the address like [URL] (example) and get the WDSL. So no problem there.
However, my WCF test page shows the address wrongly by using the server's name instead of the DNS name. And if I click on the link on the test page it won't work (can't get WSDL).
The WCF test page looks like this:
MyService Service
You have created a service.
To test this service, you will need to create a client and use it to call the service.
[URL]
The WCF service is hosted in IIS6. I would like to have a test page with the correct WSDL address so users can see the WSDL quickly in the browser just by clicking on the WSDL address.
In short: How can I change the MyServerName to inter.mycompany.com on the WCF test page? Can this be specified somewhere in the Web.config?
View 3 Replies
Mar 16, 2010
What is the use of timestamp? where should i use this?
View 2 Replies
Mar 21, 2011
what the equivalent datatype of sql server timestamp in VB.NET,and How to retrive the exact value of timestamp from sql server in vb.net.?
View 3 Replies
Sep 24, 2010
Below is sample linqtosql, is there possible to concate linq in select statement.becuz i wan to return vary number of column
[Code]....
[Code]....
View 3 Replies
Mar 25, 2011
I have a web page that has a textbox for users to enter a datestring to check against a database. The database that I am running my query against has datetime values set at minutes since 12/31/1899 and that returns a timestamp. What I'd like to do in my code is to convert my textbox entry into minutes since 12/31/1899. Does anyone have an easy way to do that?
View 1 Replies
Jan 16, 2010
I would like to know what does a field timestamp in MSSQL do?I have read a book "ASP_NET_3_5_Social_Networking" and almost all the tabels have a columnt with type "timestamp" in their example app.What is the benefit of timestamp , and why should i use it?
View 5 Replies
Mar 9, 2011
I have a column in my table that is named 'startDateTime' and 'endDateTime'. I need to select all the rows where current time stamp is in between the startdatetime and enddatetime. Note that the datatype is smalldatetime. How to do this?
View 1 Replies
Jan 25, 2010
I have created a dynamic data-driven report delivery by email in Reporting Services 2005. The report will be attached as PDF format. I can add the execution time stamp (@ExecutionTime) to the subject and comment lines. However, I cannot find a way to append the timestamp to the report name.
View 1 Replies
Oct 18, 2010
For example:
Dim testdate As String = "29/10/2010"
testdate = Convert.ToDateTime(testdate.ToString)
Response.Write(testdate)
expecting "29/10/2010 00:00:00" what I get is "29/10/2010"
View 3 Replies
Dec 29, 2010
I have the following query in which I have to convert the 'bool' valu into 'string' value as "Y" or "N". I have a class defined called ChartDosCodeInfoStruct which definesQAIndicator as String. The value I am feteching from DB is a bool value. I need to take this bool value and accordingly assignQAIndicator= "Y" or "N".
UserManager userManager = (UserManager)BaseEntityManager<DataAccessLayer.User>.GetSingleInstance();
List<User> user = userManager.GetCodersForChart(_currentChart.ChartId);
UIConfigurationObject.CoderForChart.value = user.First().FullName.ToString();
[code]...
View 2 Replies
Mar 17, 2011
I have the following query;
[Code]....
How do I modify to trim all strings?
View 3 Replies
Mar 9, 2011
I'm really new to ASP.Net and for a school project we have to create a login form. Now I have managed to create a login with LINQ doing the following:
[Code]....
And in my html page:
protected void Test_Click(object sender, EventArgs e)
{
if (Class1.Controle(Convert.ToInt32(txt1.Text), txt2.Text))
[Code]....
I was thinking something amongst those lines, but I can't call p.GebruikerWachtwoord. So I'm guessing this is completely wrong.I hope somebody can help me figure this out, and I apologise for the poor explanation, English isn't my native language.
View 3 Replies
Feb 8, 2010
I'm making a simple forum using MySQL and I use a repeater to display a list of all threads in it. I have two tables for posts, one for threads and one for replies, and I want to sort the threads by either when they were posted or when the last reply was posted in it. My SQL query is really long and hard to read so here's some psuedo code similar to it (easier to understand these column names, etc):
SELECT
threads.id,
threads.title,
threads.timestamp,
users.username,
(SELECT COUNT(*) FROM replies WHERE thread_id = threads.id) AS number_of_replies,
(SELECT COUNT(*) FROM views WHERE thread_id = threads.id) AS number_of_views,
(SELECT timestamp FROM replies WHERE thread_id = threads.id ORDER BY timestamp DESC LIMIT 1) AS last_reply_timestamp
FROM threads
LEFT JOIN users
ON threads.user_id = users.id
ORDER BY ************** DESC
What I do here is I fetch the values id, title, timestamp, the author's username, the number of replies and views for a specific thread, and I also get the timestamp for the last reply to this thread.
Then, what I want to do is sort the whole list so that the threads are displayed in an order matching when either it was posted or the last reply was posted in it (you know, like a normal forum) but I'm not sure how to accomplish this.
I tried this:
ORDER BY CASE WHEN last_reply_timestamp > threads.timestamp THEN last_reply_timestamp ELSE threads.timestamp END DESC
but that, I guess, maybe only looks at the first row and determines which one should be used so the order is not correct.
I'm not sure if it's possible to create a sort of variable that holds the value for each row of the timestamp that applies, if that's possible you could sort by that. For example:
(CASE WHEN last_reply_timestamp > threads.timestamp THEN last_reply_timestamp ELSE threads.timestamp END) AS last_activity_timestamp
...
ORDER BY last_activity_timestamp DESC
So each row has a field "last_activity_timestamp" containing either timestamp, whichever is the later than the other.
Can this be done somehow? How does everyone else solve this? It's so hard to search google because I just get lots of forums but no code.
View 6 Replies
Oct 25, 2010
I am using SQLCMD to execute a script and then output the results to a csv file. Is it possible to name the output file with a timestamp each interval that it is executed (such as every 30 minutes that the command is executed to timestamp like "output 10/25/10 830.csv"?
View 2 Replies
Dec 1, 2010
I have a question about lists. So let say i have a list with 2000 objects, object has a text and a timestamp. So i want to return the list and i wan to only show text which timestamp is > or < then datetime.now, that is example, yeah, so how should i do it better, faster? Ofc i can make another newList and then just circle tru the list and add to newly created list(newList) the items that i want to show, comparing the items timestamp, but it might take too much time and resources, is there an easier way? Cuz that list with 2000 objects can become bigger after some time.
View 3 Replies