Forms Data Controls :: The Value For Column 'ImageExtension' In Table 'News' Is DBNull?
Dec 20, 2010[Code]....
On the bold line I'm getting the following exeption:
The value for column 'ImageExtension' in table 'News' is DBNull.
[Code]....
On the bold line I'm getting the following exeption:
The value for column 'ImageExtension' in table 'News' is DBNull.
I am working on a web app for an online photo album. It is the last project in Scott Mitchell's book: "ASP.Net 2.0 in 24 hours".
I am creating a page where users can enter new photo images. The functionality for uploading an image will come later. I am working on just inserting a new row into the Pictures table with an optional category, a required title and a required description.
I am getting an error when I try to insert a new row.
Here is a screenshot of the page with a shot of the dropdown list.
The Categories are user-specific. I am getting the correct values retrieved.
[URL]
There are two pretty simple database tables involved here.
NOTE: The CategoryID and PIctureID are both autoincrement integer columns.
[URL]
The page uses a DetailsView that uses a SqlDataSource that uses the Pictures table. (The DetailsView's Default Mode property is set to "Insert". The "Enable Inserting" checkbox is also checked.)
The dropdown list uses a dropdown control that uses a SqlDataSource that uses the Categories table.
When the "Insert" button is clicked the CategoryID value associated with selected (Category) Name on the dropdown list will be used along with the Title and Description values to insert a row in to the Pictures table. (If no Category value is selected, then a null value will be used for the CategoryID. This is OK because the CategoryID column in the Pictures table allows nulls.)
My problem is that I am getting this error:
Cannot insert explicit value for identity column in table 'Pictures' when IDENTITY_INSERT is set to OFF.
(FYI: I have the full version of both Visual Studio and SQL Server.)
Here is my source code for the page:
[Code]....
I want to copy data from a table[tblExcel][No.of columns:2] to another table[ev_event] which has 5 columns, 2 columns from the another table, 3 columns from user defined value
[code].....
How to handle this error
"An explicit value for the identity column in table 'UserActivation' can only be specified when a column list is used and IDENTITY_INSERT is ON."
I am working on How to display the News Updates on page inside Marquee as hyperlink and on click on the link i have to display the details of the selected News .
which approach i can display the particular section of the page ?
I have to disply the News from Database?
I'm building an application that uses GridView controls to display data to a page.In my editemplate i have following control
<div class = "divBox">
<div>Beginn/Zeit 2</div>
<div>
<asp:TextBox ID="tbBeginn2" CssClass="fSelect"
runat="server" Text='<%# Bind("beginnDatum2") %>'/>
BeginnDatum2 has datetime-Format in SQL-Server.
For the update i use an objectDatasource with following updateparameter
<asp:Parameter Name="beginnDatum2" Type="datetime" />
Now i'm trying to update this field but i have a problem when BeginnDatum2 must be null.
I get following (german) Errormessage:
SqlDateTime-Überlauf; muss zwischen 1/1/1753 12:00:00 AM und 12/31/9999 11:59:59 PM liegen.
And this is my paramter
Public Function UpdateSeminar(ByVal kursid As Integer, ByVal id As Integer, _
ByVal beginnDatum2 As DateTime, _
ByVal endeDatum2 As DateTime, _
cmd.Parameters.Add(New SqlParameter("@beginnDatum2", SqlDbType.DateTime))
If beginnDatum2 = Nothing Then
cmd.Parameters("@beginnDatum2").Value = DBNull.Value
Else
cmd.Parameters("@beginnDatum2").Value = DateTime.Parse(beginnDatum2)
End If
I have a website where people can send an email to a group of people and then choose to have that letter posted on our website.
The problem has now become that I get so many of them, I can't keep up with doing it manually. What I'd like to do is have it go to a database and then have it automatically update the site. So, one page will have "teasers" with the Author's name, etc and a few lines of the letter and then it links to another page that has the entire letter.
Can anyone tell me if:
a) that's possible
b) how to implement it
Doing it manually has gotten out of control!
I Have a Dropdown which list the names of countries.
when i select a country, the top news related to that country must be displayed in grid.
may i know the RSS feed of every country for this application?
Any API to list all URL for RSS feed?
what I have to add/subtract from the following listview to change the table and column width. All my attemps like the style="width: 50%" have no effect.
[Code]....
I have a table which display diffrent data
One of the headers I used is shown below,In this I dont want to display the mobile phone number field so I removed that field even then in the output it is showing me the column mobile number...what is wrong?watelse should i change?
<
<
h2>Companies</h2>table
class="front-listing visiblelinks">
[Code].....
I have created a gridView control and have successfully bound DataTable (dt) to it using
[Code]....
However, I want to add a dynamic hyperlink that will take the user somewhere based on the value of one of the columns in the selected row. I'm not sure how to do that.
Object cannot be cast from DBNull to other types. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.InvalidCastException: Object cannot be cast from DBNull to other types. Source Error:
[Code]....
Line 292:
Line 293: If DataBinder.Eval(e.Row.DataItem, "Casette") IsNot Nothing Then
Line 294: stcassette += Convert.ToDecimal(DataBinder.Eval(e.Row.DataItem, "Casette"))
Line 295: End If
Line 296:
There are two dropdowns for date (Fromdate and Todate) in my webpage and by default when the page loads for the first time the dropdowns loads with the last date (currentdate), if I select some previous date in Fromdate dropdown and reload the page then it displays runtime i.e.
Object cannot be cast from DBNull to other types.
Following code is written under GridView RowDataBound Event.
[Code]....
The error found at following line:
less7daysTotal += Convert.ToInt32(DataBinder.Eval(e.Row.DataItem, "less7days"))
If I comment this line then the error moves to next line till following line.
grt28daysTotal += Convert.ToInt32(DataBinder.Eval(e.Row.DataItem, "grt28days"))
I fruther want to inform that some columns in the grid are showing 0 if there is no record but I replaced 0 to - then some 0s replaced and some not. What is the reason?
I've got a gridview that is databound with LINQ in the code behind. One column shows the id from the table. I would like to show a more human friendly product name that is associated with that id number but is from another table. Thought I had it figured out by entering a Template field in the gridview tags (in the .aspx page) and an item template within that with
<ItemTemplate>
<%Eval(Products.productName")%></ItemTemplate>
but when I try to build it says this can only be done in the context of a databound control.
Can I add this column within the gridview tags or does it have to be done from the code behind?
I am trying to looping thru a data table and update a column on each row. However after updating I am getting both before and after update records in the data table. Assuming there is only one column called "Qty" withing the data table and I want to double the value in the column. I use the following to perform updating but not getting my expected result.
[Code]....
I have a gridview which I have databinded via the quick config facility, but I need to databind one column to a completely different sql table data field - how do I do this?
If I go into Gridview tasks and select the column and edit the data binding parameter but what is the format for a table outside the source definition for the the rest of the gridview?
I have developed a news blog in asp.net 4. When I display news using literal control, the news displays without paragraph. However when i use textbox in administrative site to input the news into db--The Textbox takes the paragraph style and displays it. However i don;t want to use Textbox to display my news. Is there any solution to display the news with the paragraph style and so on? The containing component is Datalist and this is my below code.
<ItemTemplate>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr><td><asp:Literal ID="HeadlineLiteral" runat="server" Text='<%# Eval("Headline") %>'></asp:Literal></td></tr>
<tr><td><asp:Literal ID="DateStampLiteral" runat="server" Text='<%# Eval("DateStamp") %>'></asp:Literal></td></tr>
<tr><td><asp:Image ID="PhotoImage1" runat="server" ImageUrl='<%# Eval("Photo") %>' align="left" /><asp:Literal ID="NewsLiteral" runat="server" Text='<%# Eval("News") %>'></asp:Literal></td></tr>
</table>
<br />
</ItemTemplate>
I have an asp:Table. Its with is 100%. This table has only one row but 6 columns. The width of first 5 column is fixed at 150px. The last one does not have its Width specified and so it takes up the rest. The whole row has a background. If any of the first 5 column is clicked, the background of that cell is changed to white.In my development computer, the last column has about 250px. Yet in user computer, as the monitor has a smaller resolution, the last column has only 30px or so. User complains it is ugly and wish to merge the last column with the previous one. How to do so?
Source code:
[Code]....
I just wanted to know if there is any way to dynamically set the width of a column inside a table within a datalist based on the length of the text fetched from the database.I am inserting my code.
[Code]....
I have an application and am trying to display records in a 2 column table with alternate row in a different style.
How can I do this with a repeater?
This is what I am trying to replicate. each city has a checkox and each city is a record in the DB:
[Code]....
i want show ten record from table in the gridview at 2 column in five row.
like this:
------------gridview-------------
record1 | record2
record3 | record4
record5 | record6
record7 | record8
record9 | record10
1 2 3 ...
-----------------------
I have developed a news blog . I would like to add a Comment section with spam prevention capabilities into my news.My Comment table is as followsComment - CommentID,Name,DateStamp,Comments and NewsItemID as a foreign keyI'm having problem in identifying a logic . I have some questions to ask1) I'm thinking to use Formview to create a comment section?..Is it okey?2) I'm thinking to capture the NewsItemID from querystring and trying to fill up the NewsItemID(foreign key) into comment table?..Can you please show me in coding, How can I do that in coding?...if it is not a good logic,,then advise me how to do this?.3) Getting the comment from formview to db is okey, but how can I show the user comments as soon as he clicked the submit button of the formview ?..It seems quite difficult for me to do handle two events when user click the submit button 1) sending the comment into db ,2) shows the users comment in webpageHow can I do that?..Can you please provide some coding show me how can i achieve my task?
View 4 RepliesI have error:
Cannot insert explicit value for identity column in table 'UserDetails' when IDENTITY_INSERT is set to OFF.
I'm trying to insert a record through a BLL (Business Logic Layer) class with an 'Insert' button attached to the FooterTemplate of a GridView2. My code:
[Code]....
[Code]....
BLL layer code:
[Code]....
The field 'idUser' is autoincremented. When I use SqlDataSource with a DetailsView, add option it adds a record and autoincrements the 'isUser'.
i have a form with several checkboxes....i want to insert the selected checkbox values in to a single column in the sql database..
View 4 RepliesI know that the problem is my field having NULL values. However, I don't know how to have it process the code even if the field have nullshere's my code:
[Code]....