473,657 Members | 2,921 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Problem of updating two tables in gridview

1 New Member
Hello,
I am using a GridView control which displays data from 2 SQL tables.the columns are project_name,cl ient_name which are from mstproject(its fields are project_id,proj ect_name,client _id,which is a FK to mstclient(its fields are client_id,clien t_name)respecti vely.
When the user tries to insert/update the client_name the client_id should be stored in the table mstprojectSo even though in gridview client_name is displayed but client_id should be stored in the db.(i know it is confusing but)Plz tell the Sql command needed.
Please help!
Its urgent

fireburns
Jan 24 '07 #1
1 1340
enreil
86 New Member
Could you clarify a bit? Is the user updating both tables, or only the mstclient table? If only client_name is being updated in mstclient, you shouldn't need to do anything with client_id. If you are inserting a new row into client_name and want it related to mstproject, then you will need to insert a new row into mstproject that contains the client_id as a FK. There are several ways this may be accomplished, but you may try looking at some basic SQL syntax for UPDATE and INSERT commands located at http://www.mckoi.com/database/SQLSyntax.html#12

If you can clairfy what you need accomplished, I'd be glad to help.

Hello,
I am using a GridView control which displays data from 2 SQL tables.the columns are project_name,cl ient_name which are from mstproject(its fields are project_id,proj ect_name,client _id,which is a FK to mstclient(its fields are client_id,clien t_name)respecti vely.
When the user tries to insert/update the client_name the client_id should be stored in the table mstprojectSo even though in gridview client_name is displayed but client_id should be stored in the db.(i know it is confusing but)Plz tell the Sql command needed.
Please help!
Its urgent

fireburns
Jan 24 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

1
2012
by: P | last post by:
Hello, I am having a difficult time updating a record via a stored procedure using the gridview and sqldatasource. I cannot seem to be able to find a way to set everything up so that I can pass the applicable fields in the gridview to a sqldatasource which in turn calls a sproc with the appropriate parameters and data. Any ideas? Thanks in advance,
0
1616
by: Ben | last post by:
Hi, It's about a database containing (for simplifying) three fields: 'placenr' (primary key), 'place' and 'color'. The records are updatable (Edit/Update button) in a gridview. For updating the field 'color', the selectedvalue of a dropdownlist must be used, containing all possible colors (red, blue ...), so the field 'color' is ReadOnly in the gridview. Everything works, but i still have 2 problems: 1)the new color in the field is...
3
1541
by: =?Utf-8?B?dmluY2VudHc1Ng==?= | last post by:
I have an ASP.NET 2.0 application. It is pretty basic. What it does is shows a gridview of data from a stored procedure. The user can also select a date filter. The problem is that sometimes an error is thrown about getting the data. If I go in and make a change to the .cs file, the application runs fine. The change I make is like insert a space somewhere just to make the file recompile and it works again. What causes this? It...
0
2217
by: lamolap | last post by:
i have 1 gridview , a dropdownlist inside a gridview and a commandfield of (edit, update and cancel) my gidview looks like this Edit Surname Initials ParkingBay CommandField Me Y dropdownlistvalue CommandField You m dropdownlistvalue i have 2 sqldatasource. the other one is for gridview and...
1
1169
by: David C | last post by:
I have a new GridView that has an SQL table as a datasource. The primary key is included but not visible. When I click the Edit link button, change a column's data and click Update, nothing changes and I do not get any error. The UPDATE has a WHERE clause of "WHERE ID = @ID" and the ID field is in the Update Parameters. Can anyone help me resolve this? I am doing the same thing with other tables and they are updating fine. Thanks. ...
11
4069
by: Ed Dror | last post by:
Hi there, I'm using ASP.NET 2.0 and SQL Server 2005 with VS 2005 Pro. I have a Price page (my website require login) with GridView with the following columns PriceID, Amount, Approved, CrtdUser and Date And Edit and Delete buttons
11
6059
by: SAL | last post by:
Hello, I have a Gridview control (.net 2.0) that I'm having trouble getting the Update button to fire any kind of event or preforming the update. The datatable is based on a join so I don't know if that's what's causing the behavior or not. It seems like the Update button should at least do something. When the Edit button is clicked, the grid goes into Edit mode and the Cancel button takes the grid out of Edit mode. So, I don't get what...
0
1271
by: BizWeb | last post by:
Hi, i am new to ASP.NET. I have write a very simple code to try the updating of the GridView but it is not updating the data. Below is the simple code that i have use. <%@ Page Language="vb" AutoEventWireup="false" CodeBehind="Default.aspx.vb" Inherits="WebApplication1._Default" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http:// www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
0
1878
by: cmrhema | last post by:
Hi, I have a gridview problem while binding more than two gridviews. I am giving a sample scenario of what I have done so far I have two tables First table: Department , having columns DeptId and DeptName
0
8384
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8820
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8718
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8499
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8601
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
5630
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4300
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2726
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1937
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.