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

Home Posts Topics Members FAQ

need some help, driving me nuts

I have a web page that displays contact people in a drop down.
the users selects a person then clicks the go button.
The datagrid should pop with all the information on the select contact
person, correct?

Well, now my issue. I have 5 contact names in the drop down, (pop from DB)
when I select one nothing happens except for one name. I only get
information back for only one person, nothing happens if i select a
different name. The grid comes back blank, but is populated if I pick a
certain name. What would cause this to happen?

here is the code for the drop down.
if (!IsPostBack)
{
SqlDataAdapter myCommand = new SqlDataAdapter( "select distinct
contact_person from Authors", myConnection);
DataSet ds = new DataSet();
myCommand.Fill( ds, "contact_person s");
MySelect.DataSo urce= ds.Tables["contact_person s"].DefaultView;
MySelect.DataBi nd();
}

code for the grid:
public void GetTask_Click(O bject sender, EventArgs E)
{
String selectCmd = "select * from authors where contact_person =
@contact_person ";

SqlConnection myConnection = new
SqlConnection(" server=server;d atabase=db;Trus ted_Connection= yes");

SqlDataAdapter myCommand = new SqlDataAdapter( selectCmd, myConnection);

myCommand.Selec tCommand.Parame ters.Add(new SqlParameter("@ contact_person" ,
SqlDbType.NVarC har, 2));
myCommand.Selec tCommand.Parame ters["@contact_perso n"].Value =
MySelect.Select edItem.Value;

DataSet ds = new DataSet();
myCommand.Fill( ds, "Authors");
MyDataGrid.Data Source= ds.Tables["Authors"].DefaultView;
MyDataGrid.Data Bind();
}
since this code correctly agains the pubs db authors table, i took that
table and put it in my Database to verify it wasn't a db issue, that worked
fine, when took that table and made column name changes, and data changes -
nothing. I only get information for 1 person.

need help

thnx

Nov 15 '05 #1
1 1120
what value are you getting from this statement:
myCommand.Selec tCommand.Parame ters["@contact_perso n"].Value =
MySelect.Select edItem.Value;

I haven't looked at your database, but is 'contact_person ' defined as an
NVarChar(2) field, because that's what you are sending to the query.

If so, does your dropdown just show a list of these short values?

That's where I'd look if I were you.
--- Nick

"Mike" <cs*********@sb cglobal.net> wrote in message
news:eV******** ********@TK2MSF TNGP11.phx.gbl. .. I have a web page that displays contact people in a drop down.
the users selects a person then clicks the go button.
The datagrid should pop with all the information on the select contact
person, correct?

Well, now my issue. I have 5 contact names in the drop down, (pop from DB)
when I select one nothing happens except for one name. I only get
information back for only one person, nothing happens if i select a
different name. The grid comes back blank, but is populated if I pick a
certain name. What would cause this to happen?

here is the code for the drop down.
if (!IsPostBack)
{
SqlDataAdapter myCommand = new SqlDataAdapter( "select distinct
contact_person from Authors", myConnection);
DataSet ds = new DataSet();
myCommand.Fill( ds, "contact_person s");
MySelect.DataSo urce= ds.Tables["contact_person s"].DefaultView;
MySelect.DataBi nd();
}

code for the grid:
public void GetTask_Click(O bject sender, EventArgs E)
{
String selectCmd = "select * from authors where contact_person =
@contact_person ";

SqlConnection myConnection = new
SqlConnection(" server=server;d atabase=db;Trus ted_Connection= yes");

SqlDataAdapter myCommand = new SqlDataAdapter( selectCmd, myConnection);

myCommand.Selec tCommand.Parame ters.Add(new SqlParameter("@ contact_person" ,
SqlDbType.NVarC har, 2));
myCommand.Selec tCommand.Parame ters["@contact_perso n"].Value =
MySelect.Select edItem.Value;

DataSet ds = new DataSet();
myCommand.Fill( ds, "Authors");
MyDataGrid.Data Source= ds.Tables["Authors"].DefaultView;
MyDataGrid.Data Bind();
}
since this code correctly agains the pubs db authors table, i took that
table and put it in my Database to verify it wasn't a db issue, that worked fine, when took that table and made column name changes, and data changes - nothing. I only get information for 1 person.

need help

thnx

Nov 15 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
5552
by: b_prikls | last post by:
Hi all, i need your help, here is code, that makes http connection to a website throu a proxy server, and it works fine: ========================================== $proxy = "111.111.111.111"; $port = "8080"; $url = "http://www.myhost.com/folder/script.dll?variable=hello";
3
2060
by: Steve Kreis | last post by:
Somebody help. The bloggers are driving me nuts. They are direct linking to images on my site thus driving up my traffic to an artificially high level. What I would like to do is prevent them from putting direct links to images in their blog. I don't care if they steal the image. They can even right click and save, if they want -- it's the linking that bothers me. Short of encrypting all 450 pages, is there any other way out? Steve
55
3917
by: Alex | last post by:
Hello people, The following is not a troll but a serious request. I found myself in a position where I have to present a Pro/Con list to management and architects in our company with regard to developing new products (specifically - desktop products) in C#/.NET instead of the usual C++/COM that we do. Since I am not an experienced .NET developer by any definition, I don't have a good grip on the "Pro" part. The argument that I hear...
0
3558
by: Christopher Ambler | last post by:
This is long, but it's driving me nuts. I need some adult supervision :-) (and I'm not above bribing for help) I have a stored procedure that I call that returns XML to me. The SP returns 3 recordsets. The first comes as a single XML tag like this: <row recordfound="1" IsExpired="0" /> The second has any number of recordsets that look like this:
3
1787
by: RWC | last post by:
Hello, I have an issue that's driving me batty! I have a report, whose record source is SQL based on a normalized set of tables. There are no nested queries and no dlookups in this record source. When I run this record source on it's own, it functions normally with no errors. The report that this SQL is designed over, contains no subreports, no dlookups, and has no code associated with it, yet when I try to run it, I get an error...
12
1599
by: Marty | last post by:
It seems all of the sudden that user controls that contain images are referencing image sources relative to the document that I drop the control on. This obviously does not work beacuase the image source is relative to the user control, not necessarily the form. Can anyone tell me why this would be the case?
6
1341
by: Benjamin Walling | last post by:
We have 109 remote offices all running Sybase ASA Server. We collect data from these offices and consolidate it into our main server. I have written a program that will read from each office and synchronize the data. It takes a while to run because each office only has a 128k Frame Relay. I have two database classes: one for accessing the office, one for accessing the main server. The database classes expose simple functions of...
14
1756
by: mat | last post by:
Hi all, This is weird and it is driving me nuts, please can someone explain how I can get it to return the correct answer: print '$_SESSION: '.$_SESSION.'<br />'; print '$_SESSION: '.$_SESSION.'<br />'; print $_SESSION." - ".$_SESSION.' = '.($_SESSION-$_SESSION);
0
2179
by: Billie Boy | last post by:
Hi to all. I’m new here and am coming to you from Melbourne Australia. So a big HELLO 2 ALL. Now I am encountering an annoying problem in the SQL builder of the copy of VB.6 that I am using at home. My problem is that it’s driving me NUTS NUTS NUTS. I am connected to a data connection within my computer that accesses tables & views from a MS Access file.
3
2284
by: DuncanIdaho | last post by:
Hello experts IE 7.0.5730.11 Opera 9.27 Firefox 2.0.0.14 This problem only occurs in Opera and Firefox (amazing, IE does something right, or maybe not) Anyway, the problem is that when I put an image in a <divor a <td>
0
8315
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8829
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
8734
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...
0
8608
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...
1
6172
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5633
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
4164
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2733
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
1627
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.