Data Controls :: Data Not Inserting In Service Based Database In Win Form?

Apr 27, 2016

i am working on window application with local (service based database ) database. but while i am inserting with this than no data insert into nor showing any error . but when connect with external sql server its working well. 

SqlConnection con = new SqlConnection(@"Data Source=.SQLEXPRESS;AttachDbFilename=|DataDirectory|Database1.mdf;Integrated Security=True;User Instance=True");
using (var cmd = new SqlCommand("insert student (Id,Name,mobile,city) values (@Id,@Name,@mobile,@city)", con)) {
cmd.Parameters.AddWithValue("Id", 126262);
cmd.Parameters.AddWithValue("@Name", "manebde");
cmd.Parameters.AddWithValue("@mobile", 33333);
cmd.Parameters.AddWithValue("@city", "ss");
con.Open();
cmd.ExecuteNonQuery();
con.Close();
MessageBox.Show("data saved");
}

View 1 Replies


Similar Messages:

Inserting Data Into Listview From Textbox Controls On The Form

Jan 20, 2013

My project is in ASP.net and C#.I am doing webbased desktop application.I have some 4-5 textboxes on the webform like ItemCode, ItemName Qty Rate Amt and a Button called Add on the click event of the Add button i want the data from the textboxes to be inserted or added to the ListView, user can add multiple entries to the ListView through this textboxes and then finally he will have a button called save on the click of save button.i want this LIstView data to be inserted into the SQL Table

View 2 Replies

Forms Data Controls :: Inserting Records Based On Checkbox Selection In Gridview

Sep 10, 2010

Using checkboxes, can the row of record(s) be inserted into a database? I am populating a Gridview. Done. A checkbox field has been added, when the user selects one or more rows, a submit button (which is not working) needs to inserting those records into a table. The insert statment will work outside of the page but is not working using the scenario I jut described. Is this task as I have outlined doable?

View 13 Replies

Forms Data Controls :: Inserting Data Into Database From Data Listview

Feb 24, 2011

i am having problem to insert data in database from data list view...I want that when i click on download hyperlink, the file that has been downloaded and all its other related information must get save in the database

Below I am providing my code. ..when i use the below code..all the files that are show in data list view get stored in the database along with the one that i have clicked...i am biniding data to data list view of other database/table and i want to store the file info that i have downloaded into another database/table..CODE IS...

public void DataList1_ItemBound(Object sender, DataListItemEventArgs e)

{
if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem) [code]....

View 2 Replies

WCF / ASMX :: Class Library For Service (ServiceLibrary) To Access Data Form Database?

Jan 11, 2011

I created a Class library for WCS service (MyWCFServiceLibrary) to access data form my database. The database connection strings have been defined in Properties->Settings.settings. The endpoints are defined in the app.config. Tracing and logging is set to write to files on local server. This service is hosted by a .net web service. This webservice refrences the WCF service using MyWCFServiceLibrary.dll and MyWCFServiceLibrary.pdb. The web service is hosted in IIS. All this setup is working fine on the development environment.Now I want to deploy this in the QA environment. Since I am a newbie with WCF, I would appreciate some help on what needs to be done for deploying this on the QA server.1. Do I need to recompile the MyWCFServiceLibrary.dll after changing the connectionstring to point to QA database and tracing and loggint paths to the new server?2. Is there anything that needs to be done with end points or anything else?

View 1 Replies

DataSource Controls :: Inserting Data Into Multiple Tables From A Single Web Form?

Jun 26, 2010

After creating a dataset, which has CRUD statements generated two or more tables, which Data Control should I use that will allow me to insert data into fields into 2 or more tables from a single web form. I'm trying to create a web form that will allow the user to input student information, such as general information, medical information, etc.

View 3 Replies

Data Controls :: Check For Duplicates While Inserting Data From GridView To Database

Apr 27, 2014

How to check for duplicates before inserting in SQL Server inGridView in ASP.Net ....

View 1 Replies

Forms Data Controls :: Inserting Grid Data Into SQL Database?

Jan 20, 2011

On BtnClick, I am inserting all data from my RADGRID into my SQL database. But it was just inserting 'zeros' for all records. what i am missing in the code. My code is below.

[Code]....

View 2 Replies

Forms Data Controls :: Displaying Data On Gridview Based On Time Form 15 Minutes

Nov 9, 2010

I have a Transport Detaisl in DB , i want to dispay data on gridview with marquee scrolling up. Cabs are scheduled for drop every hour. So if drop is at 7pm i hav to dispaly on data of that hour from 6:30 to 7:15 later after 7:15 i have to display next hour data ie 8:00 pm drop data. I am able to get scrollin g data on gridview but how to schedlue it to scroll for such timings

View 1 Replies

DataSource Controls :: Data Is Not Inserting Into The Database?

Apr 25, 2010

Whenever I run the following code to insert a record into database:

protected void Button1_Click(object sender, EventArgs e)

View 5 Replies

DataSource Controls :: Inserting Data To Database?

Apr 11, 2010

I have this code and not sure what is wrong.

csconnection = New OleDbConnection (Stringconnection)
cscommand = new OleDbCommand("INSERT INTO Login ([Username], [Password], [Name], [DOB], [Gender], [Nationality]) VALUES (@Username, @Password, @Name, @Dob, @Gender, @Nationality);") [code]...

it just says errorat bottom of page and is there a way to tell the webpage to show me the error.

View 3 Replies

DataSource Controls :: Inserting Data From TextBox To Database?

Jul 6, 2010

I have a textbox which the user writes a word into. They then press a button to add that word to a list which is stored in the database.

What is the code to do add their word to the database? Do I need code on the main aspx file or only on the code behind?

What I tried doing up until this point is that once the button is pressed, in the codebehind the following happens:

[Code]....

I get errors telling me that the column name Program is invalid (I have a table named Program with one column named ProgramName)

I looked at a bunch of tutorials but nothing is straight forward and simple, it keeps confusing me. I need the simple step by step instruction to do this. I'm using a SQL database and coding in VB

View 15 Replies

DataSource Controls :: Inserting Data Into Database Table With Dataset Using C#?

Apr 1, 2010

Im Inserting data into database table with the help of datasets but its not inserting to table and even its not showing errors.

this is my code....

[code]....

View 3 Replies

Forms Data Controls :: Inserting/updating To Database Via Checkboxlist?

Jun 16, 2010

I've the user creation form where a user will be created by entering username. Below that is checkboxlist for UserGroup which is binded with the dataset with the all the usergroup. Hence up on entering the username and checkbox selected(as the user can belong to multiple UserGroups).At database end, there are basically 3 tables-

Users(UserID,UserName)
UserToGroup(UserID,GroupID)
Groups(GroupID,GroupName)

So when i click create new user, the UserId along with GroupID(whichever checked) is saved into UserToGroup table.Im relative to this kind of process and hence facing setbacks. Can somebody help in end to end process. From front to DB SP.

View 6 Replies

DataSource Controls :: Display A Pop Up Message Box On Inserting The Data Into The Database?

Apr 24, 2010

i am trying to display a pop up message box on inserting the data into the database. The code i am using is as follows..

[Code]....

The problem is even on inserting the data and the data getting inserted into the database, the pop up mwindow does not get displayed. On debugging, it shows the value of i as 0.

View 12 Replies

Data Controls :: Insert Data In Database Based Value In TextBox

Feb 28, 2014

I have register table in database that it has age column and I have textbox in register.aspx page that users can enter their age in it...

I want if users enter number between 10-20 in textbox it insert in age column "less than 20"

And if they enter number between 20-30 it insert into age column "more than 20"

How I can do it?

View 1 Replies

Forms Data Controls :: Checking For Duplicate Records In Gridview Before Inserting To Database?

May 10, 2010

I need to check for duplicate records before inserting them into the SQL database.Thus I have the following codes:

For count = 0 To GridView1.Rows.Count
If (GridView1.Rows(count).DataItem("Student Name").Equals(dtDataTable.Rows(count).Item("Student ID"))) Then
lblMsg.Text = "Records Existed"
End If

but there are error message. "Object variable or With block variable not set."

View 11 Replies

Forms Data Controls :: Inserting Row In A Gridview And Send The Row Values To Database Table

Apr 27, 2010

I want to insert Data Rows into Gridview from web page and I want to send the Inserted Row to Database table.

So I have 3 columns to insert the row.

I added itemtemplate & fotter template with textbox control for each column Inside Templatefield.

I added two buttons [Insert & Cancel buttons ] in fotter template to insert the row in Gridview.

After debugging the page I can't see gridview in my webpage. i can see only EdItdatatemplate items only.Why ?

Can you look at my code & me to insert the records in gridview..

.aspx page,

[Code]....

.cs

[Code]....

View 7 Replies

DataSource Controls :: Inserting Excel Data Via File Upload Into Sql Server Database?

Apr 28, 2010

I have requirement that User can Upload the Excel Sheet Data to sql server Database at once.

View 16 Replies

Forms Data Controls :: Date Time In Text Box Not Inserting Into Database Table?

Mar 13, 2010

In short, I have 3 text box fields on an .aspx page named as follows:-

TextBoxIncident
TextBoxDate
TextBoxDescription

in addition a sql datasource is on the page which is connected to the incident table with an insert query which allows the data entered into the fields to be inserted into the database...

The Textboxincident and textboxdescription fields allow the user to enter data into them...

the TextBoxDate field is a read only and the code behind file enables the text box to show the current date and time the code im using is shown below...

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

Dim TextBoxDate As TextBox
TextBoxDate = FormView1.FindControl("TextBoxDate")
TextBoxDate.Text = DateTime.Now
End Sub

When run in browser the textboxdate field shows the current date and time...and Once the textbox incident and text box description fields have been filled in and the submit button is clicked, the fields should be bound to MS SQL table called Incident. This did work before, however it as suddenly stopped working and now displays the following message to me:-

Arithmetic overflow error converting expression to data type datetime. The statement has been terminated.

View 2 Replies

Forms Data Controls :: Inserting CheckBox List Values Into Database Rows?

Dec 28, 2010

My problem is this "I have all the tools, VS 2005, 2008, 2010. I have every book, I have SQL server 2005 and 2008" I have all the tools, but I do not know what tool or technology to use when starting out learning all this. I juat do not know what book teaches what I need to do for something like below.

Here is my question:

I created an .ASPX webform that is to "Submit" to a SQL 2005 database. I gave this form to my DBA, and he has made up a Data Model. Now I have to figure out how to write the ASP.NET code so it will submit to the DB. My first issue is not knowing this:

1. "How do I loop through my CheckBox List", and then insert the values checked into a "Database Table" (Each Checkbox value MUST be a seperate row in the table, the DBA does not want a seperate column for each checkbox value)

2. The database is using stored procedures

3. My third issue is this: "I do not know "where" to put the "code". If you do resond to this,

Summary: I just need shown the code on how to "loop through" the CheckBox List on my form, and insert those values into a database table as seperate rows.

View 2 Replies

Data Controls :: Save Form Data To Database Using AJAX Modal Popup

Dec 17, 2013

I am new to AJAX. I am designing a feedback form for a video conferencing session in asp.net web application which will be displayed as a modal window. The questions on the modal window will be displayed from a table stored on SQL Server 2008 and the responses of those questions should again be stored back in a different table on SQL Server after user clicks on the SUBMIT button on the modal window (and also, the window should close after the action).

I am not aware of the way to retrieve data from or store data to SQL server from modal window though I know how to retrieve and store data using asp.net and c#...

View 1 Replies

Data Controls :: Insert Form Data Into Database And Display In GridView?

Dec 13, 2013

My requirement is need to develope a web page in asp.net using c#, which contain 4 textboxes 4 labels and 1 button and finally gridview.

Lables are:

1.StudentId (it shld be identity key and primary in db(automatic id updation))-textbox

2.StudentName-textbox

3.Course-dropdownlist box

4.Address-textbox

Note: studentId and name shld have validation.

Button:

1.Insert 

REQUIREMENTS:

Gridview should hve edit and delete link button atlast. In c# pgm thr should be a sql connection when values are entered in textboxes after clicking Insert button it should insert value in gridview and also in database. If the edit button is clicked the values should display in textbox and their only we should update the values and main thing we click on edit link button the INSERT button should change to UPDATE button after updating the updated values it should save in gridview and also in database and after updating it should chance again to insert button. 

The delete button shld delete the selected row in gridview. 

View 1 Replies

DataSource Controls :: Recovering Data Form SQL Server Database Primary Data File?

Jan 18, 2010

I have SQL Server Database Primary Data File.

I want to recover the data from that file in to my data base which has the empty tables.

I have Microsoft SQL Server Query File which contain the table structure.

View 1 Replies

Data Controls :: Automatically Save Form Data To Database At Regular Intervals Using JQuery AJAX?

May 7, 2015

need to save autonatically after 10 am.

View 1 Replies







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