Sqldatareaderand Field Name In Database?

Jan 13, 2010

in my database i have a field that name is " Filelensql" and its type is:"nvarchar(200)"

ALTER PROCEDURE [dbo].[InsertFile]
@FileName nvarchar(50),
@FileUrl nvarchar(200),
@Desc nvarchar(MAX),
@Tag nvarchar(1000),
[code]...

View 3 Replies


Similar Messages:

Way To Make Database Field A DateTime Field To String

Oct 5, 2010

Dim query as String = "Select * from openquery (devbook, 'SELECT wb.arrival_time FROM web_bookings wb ')"All I need is to convert my arrival_time into a datetime field in the query

View 1 Replies

Update Certain Field In Database

Nov 26, 2010

I want to create a web page using ASP.NET (C#, SQL queries) to keep track the login and logout time of all employees of a small store and total hours they work every day. Here are the fields in my table (employID, logintime, logouttime, totalhours). Once an employee log in, he just clicks the Login/Logout button. The program will store the current system time into the "logintime" field while leaving the "logouttime" field and the "totalhours" field empty until he clicks the button again at the end of the day. So when an employee clicks the button, I want to determine if he wants to login or logout by examing the "logouttime" field. If it's emty (NULL), I know he wants to logout. If the "logouttime" field is not empty, I know he wants to login so my progam will create a new entry for him. My question is, what is the best way to determine if he wants to login or logout? This is how I approach it:I create a SELECT query: "SELECT COUNT(*) FROM mytable WHERE logoutime IS NULL and employID = @employeeID" (this employeeID is the ID an employee uses to log in the web page). I use this "count" value to determine if the next operation is to let him logout or create a new entry. If count # 0, that means the employee needs to logout. I just need an UPDATE command to update value for logouttime field. I need another "SELECT * FROM mytable WHERE logouttime is NULL and employID= @employeeID" because my previous SELECT query returns only the count value. I will use a DataReader for the 2nd SELECT to walk through the fileds of the matched row to retrieve the value of "logintime" field for subtracting operation to get the total hours. Is there a way I can access the table to determine if the employee "logouttime" field is empty and at the same time using that open connection to retrieve his information if the "logouttime" field is empty? I hope what i'm trying to say make sense. I haven't coded it yet. Just logics at this point.

View 3 Replies

Getting Field Count From Database

Feb 8, 2011

I am having a problem that I want to get a list of items(like categories) and count of records corresponding to those items (like subcategories).. I have two tables (categories, and users). I want to get the list of categories from categories table and the count of subcategories from the users table...I donot know how to do this. e.g. "select categories from categories" and "select count(subcategories) from users where category = ?"

View 5 Replies

Add Whole Records Of Field In DropDownList From Database

Feb 5, 2010

i want to add the particular field in dropdownlist by coding so hows that's possible

View 2 Replies

How To Update Database Field Every Year

Mar 24, 2011

I have a database which contains 2 fields called DateOfBirth and Age, for storing users DOB and age respectively. I want the Age column to be automatically incremented by 1 every year, according to the DOB matching server date.

What could be the best way for achieving this? I am using asp.net and sql server 2008.

View 1 Replies

ADO.NET :: Retrieve Two Database Field Values

Oct 6, 2010

this method is meant to retrieve two database field values, but i'm getting error: Must declare the scalar variable "@FlyingFrom".

[Code]....

View 6 Replies

C# - Return First 100 Letters From Database Field?

Jan 19, 2010

In my database MYDB i have a table called MYTABLE and inside it I have a column called NAME. I want to only return the first 100 characters of the column NAME. (NAME can be up to 2000 characters).How can this be done in SQL as I want to set the first 100 characters to a ASP.NET label.

View 8 Replies

How To Add Database Field Dynamically Into Crystal Report In C#

Oct 21, 2010

How can add database field dynamically into Crystal report using C#.

I want to get change crystal report with respect to Database field.

View 1 Replies

How To Auto Increment Field Value After Inserting To Database

Dec 6, 2010

i'm working on my first project on asp.net using c#.

I'm adding a couble of fields to database but i need the primary key of the master table to add it to sub table.

The database contains 2 tables :

Question Table :questionID(primary key and identity) , questionInText

Answer table : answerID , answer1,answer2 , questionID


code used to insert to db :

[code]....

View 1 Replies

Convert Database Field To Time Format

Oct 5, 2010

I'm trying to make my string a nice formatted time but the column in the database isn't set up as a date/time field is there anyway I can do this? Here's my query

Dim query as String = "Select * from openquery (devbook, 'SELECT wb.arrival_time FROM web_bookings wb ')"

And here's where i'm converting it

Session("formattime") = DateTime.Parse(drv.Row("arrival_time")).ToString("hh:mm")

The arrival_time field only has 4 numbers in like this 1000 so I need a way of converting it to a nice format like this 10:00AM

View 5 Replies

MVC :: Comparing An Input Field Against A Database Table?

Dec 6, 2010

I am REALLY new to ASP.NET MVC, and it is alien to my way of thinking.In my project, I have managed to get as far as allowing the user to add, edit or delete entries from a table. What I want to do is ensure that a specific field (i.e. "Tank_Number") does not get duplicated. What is the correct way to implement this?

I would like to use custom validation in the model class, the reason being the handy error messages, but am getting more confused as I read more articles. At the moment, I am using an If statement in the Controller, but it isn't ideal.

Here is my example code:

Controller [Code]....
Model

[Code]....
View

[Code]....

View 3 Replies

Save Byte To Varbinary (64) Field In Database

Jun 7, 2010

I have

byte[] a = HashEncrypt("a");
with
public byte[] HashEncrypt(string password)
{
SHA512Managed sha = new SHA512Managed();
byte[] hash = sha.ComputeHash(UnicodeEncoding.Unicode.GetBytes(password));
return hash;
}

I want to save byte[] a to my database. My database field is a varbinary(64). I'm using SQL Server 2008. I want to know the insert query with C# code. I am using ADO.NET

View 1 Replies

SQL Server :: Using A Database Field As A Hyperlink Query?

Sep 3, 2010

I have three tables in my sql database

contacts

survey answers

respondent_initial

Contacts holds all customer data with custid.

survey answers has assigned everyone how took the survey a number in a field called
respondent_no.

respondent_initial holds input from a webform where I populated it with the custid from contacts and respondent_no from survey answers before the webform input is inserted.I want to send an email to them that had there respondent_no in a hyperlink to the webform so that when they entered their data into the webform it would use the repondent_no to determine where to insert the form data.

Example joe clicks http://www.myplace.com/order.aspx?23

Mike clicks http://www.myplace.com/order.aspx?125

it would look up respondent_no (23) from the respondent_initial table and insert the data in that row in the database for joe's webform entry and it would look up respondent_no (125) from the respondent_initial table and insert the data in that row in the database for mike's webform entry. my code behind looks like this

// Create command
comm = new SqlCommand("INSERT INTO respondent_inital (Practice_Name, Address1, Address2, City, State, Zipcode, Phone, Email, Contact, Dealer, item_9223, item_9129, item_42795, item_30695, item_42834) VALUES (@Practice_Name, @Address1, @Address2, [code]....

View 10 Replies

Add Codes It Will Delete From The Database Once Checked A Field?

Oct 8, 2010

I currently have a page that consists of a pop up page using JQuery. But the codes are in Html format but I am using aspx to code it. Now I am intending to have check boxes in the pop up that when checked will delete the data from a database that I have checked. But I am not sure as to how I am going to do it, As I am not familar with using JQuery and how to add codes such that it will delete from the database once I have checked a field.

View 4 Replies

Access :: Extract Month From Database Dob Field?

Mar 15, 2010

I have an html web site and want to list all members who are having a birthday in the current month.

The mdb database field is a date/time in the format of date/month/year eg 13/3/10

SelectCommand="SELECT [MemFirstName], [MemLastName], [MemDOB] FROM [Members] WHERE

(Members dob month = the current month)"

I want to write the results into a <div> on the page

View 5 Replies

Web Forms :: How To Use Database Return Many Field And Insert In A Object

Sep 28, 2010

how to use database return many field and insert in a object(like any Collection ,Array,Hashtable etc)

[code]....

View 2 Replies

MVC :: Boolean Database Field And Create View Template?

Mar 23, 2010

created a create view for an entity in my Linq model which had a bit field in it but it turned out a textfield..can you give me an example of an ascx that will enable me use a checkbox for this instead of a textbox, which the create view template uses for ALL the fields.Also, how can i get the template to use html.displayfor() instead of html.textbox?

View 5 Replies

DataSource Controls :: Padding In Varchar Database Field?

May 7, 2010

I am using:

href='<%# Eval("Directory")+eval("Agenda")%>

to provide a link to documents held in directory so directory contains [URL] or [URL] Agenda contains

00209-FebruaryMtgMin%5E_.pdf

If I declare Directory as VarChar(nnn) where nnn is large enough to accomodate the longer field, The statement <%# Eval("Directory")+eval("Agenda")%> returns

[URL]self.aspx/.Public/ 00209-FebruaryMtgMin%5E_.pdf

How can I get rid of the Pad characters?

View 3 Replies

Sql Server - How To Change Type Of Database Field In Mvc Application

Jan 4, 2011

I have an asp.net mvc 2 application with a SQL Server database accessed by the Entity Framework ORM. Now I found out I had used the wrong datatype for one of the fields in the database - int instead of double.

Now, this is not a big commercial application, but it is nevertheless already in use internally in my company. It works fine, but the users would need to be able to enter decimal values rather than just integers...

So my question is, can I change the type of the field after the fact so to speak, and not lose the data already entered? Of course I would have to change the references to this field in the model and everything that references it, but is it possible at all without losing the data?

View 1 Replies

Vb.net - How To Insert NULL Into Database If Form Field Is Empty

Jan 18, 2011

I have a form and stored procedure that inserts the data from the form. It works fine except that if a field isn't filled in it doesn't insert a NULL into sql it inserts "".

I've tried a few different ways but none seem to insert NULL, the one below still inserts "", can anyone point me in the right direction.

Here is the required part of the code, if you require more just let me know.

[code]....

So if I enter nothing into address1 field it should write NULL to screen but it always writes NOT NULL.

View 4 Replies

Multiple Checkboxes - Set Language Proficiency Field In Database

Apr 8, 2010

I am developing a Jobsite website. There are two options for resume posting on website

1. A resume format in which jobseeker can insert values in all the fileds which are normally exists in a resume.

2. Jobseeker can upload the resume.

in first point Jobseeker has to fill form through controls, everything is fine but the problem is with one field named "Language Proficiency". How do I set Language Poficiency field in database and how do I get values from checkboxlist. Is there only one checkboxlist or three.

View 13 Replies

Access :: Bind Populated Label To Database Field?

May 10, 2010

I'm using the below code to populate a label inside my insert template with the logged in users' name...

<asp:Label runat="server" Text="<%# Membership.GetUser().UserName %>" id="Label1">
</asp:Label>

Now that my label gets the UserName how can I also bind this label to the field "name" in my database when the user submits?

[Code]....

View 2 Replies

DataSource Controls :: Store Value In Database - Int Type Field

Apr 15, 2010

I want to store value like 01,02,03 in database but whenver i do so the database transfor those figures into 1,2,3. The field is Int Type.

View 4 Replies

DataSource Controls :: Inserting The Right Field In The Database Using TextBox?

Feb 24, 2010

I creating a real Estate web application. I have a form where the admin can type price for a specific property. The price will be insert into the SQL database.

Which is the best SQl data type to store for example : £150.000 and then retrieve it from the database. It has to be any type of SQL data that store number as I have a search on the website that compare values of numbers. It cannot be for example varchar othewise I will get an error.

View 3 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved