SQL Server :: Add Data That Maybe Already Exists?
Nov 22, 2010
I have a database for a shop. Now I have run into problem when I'm adding products. I have a page where i add general info of the product that will be adding to the product table. Then I should have a page where I can add colors and sizes and so on. But how do I do that? When I add the product I set a price in the productdetail table and colorId and sizeId is sett to null. If I add a color to the table how do I do this the easiest way? I will not have a product where both colorId and sizeId is null. I have this SP and table structure. Then I'll do the same when I add sizes.
[Code]....
View 8 Replies
Similar Messages:
Dec 1, 2010
Banging my head with this one...
I have a SQL query that pulls data for charting based on a per month basis. The month range is dynamic and selected from the front end. My issue is when no data for a month within the month range is present, that month is skipped. Is there a way/method to have the query give a 0 value for the columns when no data for that month exists? Below is my current query
[Code]....
View 8 Replies
Dec 13, 2010
I would like to check whether a folder exists or not if not create. I'm sure this folder exists, but for some reason I get "false" when I check with "Exists" method.
The only reason I think could be because of the W: drive? I moved this application to production site and even there it returns false.
while I'm type in Windows explorer on my localhost and on the server "W:/Webs/ASPPages/cropper/uploads" it opens this folder. So my localhost and IIS server has W: mapping.
for test I tried to create the folder then it says can't find the path...
userFolderName = @"W:/Webs/ASPPages/cropper/uploads"
//I also tried @"W:WebsASPPagescropperuploads"
//I also tried @"W:WebsASPPagescropperuploads"
//I also tried "W:\Webs\ASPPages\cropper\uploads"
DirectoryInfo dirInfo = new DirectoryInfo(userFolderName);........
View 3 Replies
Jan 4, 2010
I'd like to use a simple switch to display one image or another but I need a way to find out if the image exists.
If FILEEXISTS("pathtojpg") Then
'Display jpg
Else
'Display "no_image_yet.jpg"
End If
View 5 Replies
Dec 21, 2010
I am very new to this and have watched a lot of the videos. While trying out VWD2010 and SQL2008 Express, I come across many things, I just don't know how to do. Here is the latest:
I have a Table
UserId - Int - AutoIncrement
FirstName - Var(10)
LastName - Var(10)
I also have an ASP web page that allow the user to enter a first name and last name. It also has a button to submit. What I would like to do is have a Select statement check to see if the name already exists, then send a comment back to the user via a label. If it doesn't exist, then I would like to Insert the info and then again inform the user via label.
SelectCommand="SELECT COUNT (UserId) FROM Users WHERE ((FirstName=@FirstName) and (LastName=@LastName))"
InsertCommand="INSERT INTO User(LastName, FirstName) VALUES (@FirstName, @LastName)"
<InsertParameters>
<asp:ControlParameter ControlID="tbFirstName" Name="FirstName"
PropertyName="Text" Type="String" />
<asp:ControlParameter ControlID="tbLastName" Name="LastName"
PropertyName="Text" Type="String" />
</InsertParameters>
<SelectParameters>
<asp:ControlParameter ControlID="tbFirstName" Name="FirstName"
PropertyName="Text" Type="String" />
<asp:ControlParameter ControlID="tbLastName" Name="LastName"
PropertyName="Text" Type="String" />
</SelectParameters>
On the code behind, I get lost. (Obviously this doesn't work, but I don't know how to go about getting a results back. Protected Sub bSubmit_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles bSubmit.Click
SqlDataSource1.Select(DataSourceSelectArguments.Empty)
(get a return)
(check return value, if <>0 then
lblResults.Text = "exists!"
else
SqlDataSource1.Insert()
lblResults.Text="added!"
end if)
End Sub
View 3 Replies
Oct 27, 2010
I want to be able to check if a value exists before inserting a new record in the table. I am taking a nvchar value from a textbox and want to compare it to existing values in the table. My codebehind is:
[Code]....
It is also important to filter down by CompanyID which is held in a Profile table. So the value can be equal in records where the CompanyID does not equal the loggedin Profile.CompanyID. So a user with a CompanyID of 2 can have a value in the table for SubType as "laptop" but a user with CompanyID of 3 can still enter "laptop" if there is no match for "laptop" and companyId = 3.
View 5 Replies
Jan 25, 2011
Is there any benefit (performance wise) to check if a record exists before updating it or do I just go straight in with an UPDATE WHERE?
View 2 Replies
Oct 13, 2010
I would like to check and see if a record exists before doing an insert. Here is the code I have tried:
[Code]....
View 2 Replies
Dec 4, 2010
I am developing a website in ASP.NET with SQL SERVER as backend.
I want to find the best(FASTEST) way by which I can find if USERNAME exists or not.
My application is taking a bit of time finding that out. Do I need to look into my TABLE structure,indexes.
Is there any replacement for the query
Select username from usermaster where username=@Username
View 3 Replies
Jan 6, 2011
i have a site that will enable users to download an ebook file.i have successfully built architecture to enable users to download pdf and txt files, but it won't work when i try with a .mobi file, even though i know the file exists.the site works by allowig users to upload their work as .doc, .docx or .odt. once it's verified, the site publishes it as .pdf, .txt and .mobi and makes it available for download. the download code is...
string mstitle = title.ToUpper();
string dlpath = [the server path] + msid + mstitle + ".mobi";[code]....
(there are also versions with .txt and .pdf) the file definitely exists at the location in .txt, .pdf and .mobi extensions. however, the .mobi version simply won't work i get an error 404 resource not found. mystifyingly, the pdf and txt versions work perfectly.
View 8 Replies
Sep 24, 2012
I have one text box in my page and 1 button
users type some number in this TB
I want when users enter their number in text box and click on button to insert it to database
it checked if in database was that number it show message that "this number is in database please type other number"
how i can do it?
View 1 Replies
Aug 19, 2010
I have a form for data entry which has a checkbox for featured item.
Only one feature item should exists in the database.
How can I check when doing the insert if another item in the table is a feature item?
I would likt to deactivate the one as feature and activate the new one.
View 9 Replies
Feb 2, 2011
I'm getting a "no data exists for the row/column" error when i am giving wrong value in key column and press button to import data from excel,how can i fix this error and avoid collapsing the application.
[Code]....
View 5 Replies
Aug 17, 2010
I am having a slight problem with a feature I am trying to get working on a website I am doing. I keep getting the "No data exists for the row/column" error. And the problem appears to be with this line of code:
[Code]....
View 3 Replies
Feb 28, 2011
I have some code with a connection string going to a mdb, the query looks correct to me and I know that the data stored in the table exists but when I run the query in my code it says: No data exists for the row/column.
[Code]....
It has crossed my mind that perhaps the way the data is put into the program is not compatible with the data in the database, I don't know if that is a valid thought though.
View 3 Replies
Mar 3, 2010
I am using a sqldatasource for filling one GridView and on page loading or before taking any action, there is no data (default value=null) and normally the datagrid is empty (using emptydatatext="no records found etc etc...").. Issue is I can not see the header of that grid in empty case, but only the emptydatatext!
I have tried to use some code of the references below, but no success, because I'm not using DataTable control as a DataSource, but directly filling the gridview from sqldatasource! useless references:
[URL]
P.S. I'm not usign DataTable as a DataSource, but sqldatasource (from the Data Controls), and I want to show header, when sqldatasource is null or empty ?!
View 1 Replies
Oct 15, 2010
I have 2 tables:
- Salesmen with Pk.SalesmenID
- Appointments with Fk.SalesmenID and busy(bit)
How can I check if every salesmen has at least one appointment
Am I on the right way with statement below, though I got syntax problems
[Code]....
View 5 Replies
Aug 12, 2010
I have aregistration form where the user enters, among other things, a username. The form must make sure that the username is not already taken before the user submits the info.
Here's my code so far in the .aspx.cs:
[Code]....
I'm not sure how to call this function from the .aspx part... .
[Code]....
View 16 Replies
Dec 9, 2010
I have a page with a simple textbox, when an OrderNo is entered in te textbox the page is populated with 2 or 3 gridviews depending if the order has items reserved or on back order.
GridView1 has data about the order, like status, payment details.
GridView2 has data about orderitems, each row displays an item from the order with stock and order quantities
GridView3 has data about backorders, each row displays an item from the order with quantity reserved and quantity on back order. As is no data for GridView3 if order is not on backorder I thought that I can enclose my code inside an if block
if GridView3 isnot nothing then
'getting some data from the cells in GridView3
endif
but the code still executes.
View 2 Replies
May 7, 2015
how to check whether a dropdownlist contains particular value for the below codei have a value name
manager="manogar1";
if(mydropdownlist valuecontains the value "manogar") {
} else {
}
View 1 Replies
Apr 27, 2016
I need to check whether table named 'CSE' is existing in database or not. if it exists, i want to drop the table 'CSE'.
View 1 Replies
May 7, 2015
check if variable exists in dataset ?
View 1 Replies
Mar 18, 2010
Test to know if a file exists already or not using DetailsView with c#?
DetailsView :
DetailsView source :
<%@ Page Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="Insertclient.aspx.cs" Inherits="Insertclient" Title="Insert client" %>
<%@ MasterType VirtualPath="~/MasterPage.master" %>
[Code]....
before inserting a new Cod-client i want to know first if the Cod_client exists already or not and where to insert that cod in my application ,
View 3 Replies
Feb 26, 2010
I want to create C# code that checks a hyperlink in a repeater and checks if the file exists. If not, the hyperlink is not visible. The path and document ar pulled from a sqldatasource:
[Code]....
View 2 Replies
Feb 11, 2010
how can we determine the exactly datagrids row and column that exists a button that has been pushed?
Protected
Sub ela(ByVal
sender As
Object,
ByVal e
As
System.Web.UI.WebControls.DataGridCommandEventArgs)
' Dim id As Integer = datagrid1.DataKeys(CInt(e.Item.ItemIndex))
Dim id
As
Integer = e.Item.Cells.GetCellIndex
Response.Write(ID)
End
Sub
but how exactly we determine the row and the column?
View 6 Replies