Click here to Skip to main content
15,907,913 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I changed a query for a bound datagridview. Originally the datagridview showed all the columns, but I removed some of the columns by rightclicking on the datagridview. I changed the fillby query to only include certain columns I selected. Now it isn't working. The same query works in MS-SQL, but it doesn't work in Preview data in the dataset designer. Can someone give me an idea of how to look for where my error is?
Posted
Updated 24-Sep-10 9:54am
v2
Comments
Hiren solanki 24-Sep-10 22:59pm    
Could not figure out the question, can you post the query and question in detail ?
envprogrammer 27-Sep-10 10:45am    
In the form designer:
//
// resultdataGridView1
//
this.resultdataGridView1.AutoGenerateColumns = false;
this.resultdataGridView1.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.resultdataGridView1.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
this.chemical_name,
this.casrnDataGridViewTextBoxColumn,
this.resulttextDataGridViewTextBoxColumn,
this.interpreted_qualifiers,
this.remark,
this.validatorqualifiersDataGridViewTextBoxColumn,
this.methoddetectionlimitDataGridViewTextBoxColumn,
this.reportingdetectionlimitDataGridViewTextBoxColumn,
this.detectflagDataGridViewTextBoxColumn,
this.reportableresultDataGridViewTextBoxColumn,
this.quantitationlimitDataGridViewTextBoxColumn,
this.resultunitDataGridViewTextBoxColumn});
this.resultdataGridView1.DataSource = this.dt_resultBindingSource;
this.resultdataGridView1.Location = new System.Drawing.Point(39, 523);
this.resultdataGridView1.Name = "resultdataGridView1";
this.resultdataGridView1.Size = new System.Drawing.Size(951, 150);
this.resultdataGridView1.TabIndex = 19;
this.resultdataGridView1.RowLeave += new System.Windows.Forms.DataGridViewCellEventHandler(this.dataGridView1_RowLeave);
//


In DataSet Designer:
<dbsource connectionref="SpectraConnectionString (Settings)" dbobjecttype="Unknown" fillmethodmodifier="Public" fillmethodname="FillByTestandFacID" generatemethods="Both" generateshortcommands="true" generatorgetmethodname="GetDataBy2TestID" generatorsourcename="FillByTestandFacID" getmethodmodifier="Public" getmethodname="GetDataBy2TestID" querytype="Rowset" scalarcallretval="System.Object, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" useoptimisticconcurrency="true" usergetmethodname="GetDataBy2TestID" usersourcename="FillByTestandFacID">
<selectcommand>
<dbcommand commandtype="Text" modifiedbyuser="true">
<commandtext>SELECT rt_analyte.chemical_name, dt_result.cas_rn, dt_result.result_text, dt_result.interpreted_qualifiers, dt_result.remark, dt_result.validator_qualifiers,
dt_result.method_detection_limit, dt_result.reporting_detection_limit, dt_result.detect_flag, dt_result.reportable_result, dt_result.quantitation_limit,
dt_result.result_unit
FROM dt_result INNER JOIN
rt_analyte ON dt_result.cas_rn =rt_analyte.cas_rn
WHERE (dt_result.test_id = @test_id) AND (dt_result.facility_id = @facility_id)
<parameters>
<parameter allowdbnull="false" autogeneratedname="test_id" columnname="test_id" datasourcename="Spectra.dbo.dt_result" datatypeserver="int" dbtype="Int32" direction="Input" parametername="@test_id" precision="0" providertype="Int" scale="0" size="4" sourcecolumn="test_id" sourcecolumnnullmapping="false" sourceversion="Current">
<parameter allowdbnull="false" autogeneratedname="facility_id" columnname="facility_id" datasourcename="Spectra.dbo.dt_result" datatypeserver="int" dbtype="Int32" direction="Input" parametername="@facility_id" precision="0" providertype="Int" scale="0" size="4" sourcecolumn="facility_id" sourcecolumnnullmapping="false" sourceversion="Current">




1 solution

may be autogenerated column property set to false,so first it set to true then bound the columns
 
Share this answer
 
Comments
envprogrammer 27-Sep-10 10:44am    
Thank you for your reply. I changed the names of the columns and deleted some variables--so i don't think the datagridview should be autogenerated. Does anyone know if that could create an error?
envprogrammer 27-Sep-10 10:57am    
Reason for my vote of 5
Automatic vote of 5 for accepting answer.
envprogrammer 27-Sep-10 18:35pm    
It looks like I needed to recreate the TableAdapters when i change queries in the DataSet Designer.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900