Conditional Population Of A DropDownList Control

Apr 22, 2008

I have two DropDownList controls, ddlGroup and ddlLocation.

The contents of ddlLocation will be determined by the selection of ddlGroup. A better explanation is as follows:

ddlGroup =



ADVANCED DEVELOPMENT

DESIGN

HEAD TEST

INK R&D

JETTING

PROCESS

RELIABILITY



The SQL query that shows my logic is:

IF @Group = 'ADVANCED DEVELOPMENT'
   SELECT Location FROM tblLocations WHERE Location like 'AD%'
ELSE IF @Group = 'DESIGN'
   SELECT Location FROM tblLocations WHERE Location like 'DE%'
ELSE IF @Group = 'HEAD TEST'
   SELECT Location FROM tblLocations WHERE Location like 'HT%'
ELSE IF @Group = 'INK R&D'
   SELECT Location FROM tblLocations WHERE Location like 'INK%'
ELSE IF @Group = 'JETTING'
   SELECT Location FROM tblLocations WHERE Location like 'JT%'
ELSE IF @Group = 'PROCESS'
   SELECT Location FROM tblLocations WHERE Location like 'PR%'
ELSE IF @Group = 'RELIABILITY'
   SELECT Location FROM tblLocations WHERE Location like 'RL%'


I need to define the content of ddlLocation after a selection is made in ddlGroup; how can I accomplish this using Visual Web Developer 2008 Express Edition?

View 2 Replies


ADVERTISEMENT

Problem Modifying Sqldatasource For Dropdownlist Control

Jan 9, 2007

i use asp.net 2.0 and c#
initially the dropdownlist control is bound to the queryA ("select * from tableA".) for sqldatasource1
now in a button click event, i want to change the query to queryB ("select * from tableA where id = @id".) 
in the code below, i can change the SELECT query of sqldatasource1 from queryA to queryB, but how can i give value to the parameter? please help
protected void Button1_Click(object sender, EventArgs e)
{
     sqldatasource1.SelectCommand = queryB

 

View 3 Replies View Related

Conditional Formatting In A Matrix Control

Aug 22, 2007

Hi there.

I am creating a report that the requirements need different background colors based on the row or column as shown below:










Community
Total # of Respondents
Resident's Overall Satisfaction Rating
Quality of Repair

May '07
41
3.6
5.0

April '07
14
1.8
3.0

Q2 '07
55
2.7
4.0

March '07
36
3.6
3.0

February '07
28
4.0
1.2

January '07
22
2.2
4.0

Q1 '07
86
3.3
2.7

YTD '07
141
3.0
3.2

December '06
33
3.8
4.2

November '06
27
2.6
5.0

October '06
42
1.8
3.0

Q4 '06
102
2.7
4.1

September '06
58
4.0
2.2

August '06
84
2.0
1.6

July '06
52
3.2
3.4

Q3 '06
194
3.1
2.4

June '06
40
2.4
4.2

May '06
41
3.6
5.0

April '06
14
1.8
3.0

Q2 '06
95
2.6
4.1

March '06
67
N/A
3.8

February '06
38
N/A
2.8

January '06
N/A
3.8
N/A

Q1 '06
105
3.8
3.3

YTD '06
496
2.9
3.5

Rolling 12 Month Average
477
2.9
3.3'
I can get the row colors to work great with an expression, but when I try to add the gray column with conditional formatting for the Resident's Overall Satisfaction Rating question, it clobbers my row formatting. I am thinking that I will have to do some gnarly expression in each of the rows and columns using the InScope function. Does that sound about right, or is there an easier way?

Thanks, Mike

View 1 Replies View Related

Conditional Control Flow Element

Jun 22, 2007

Hi:

A branching element is critical to any process flow. Currently, as far as I know, there;s only a Conditional Split Data Flow Element. There is no direct way I can branch out in a control flow.

In some cases, I could branch by using a conditional operator ?: to either create a dynamic sql string for each patch, or a package name for a Package Execution task and so on.

This approach is not always good enough.



Are there others out there who want a Conditional Control Flow element?

TIA
Kar

View 3 Replies View Related

Conditional Execution In The Control Flow Via Script Task

Oct 25, 2006

Greetings.

I'm trying to conditionally execute a dataflow based on the presence of a data file. If the data file isn't present, I'd like to execute gracefully without error.

Logic is as follows:

If FileExists Then
execute dataflow
Else
exit w/o error
End If

I've got the code ready to go, but I'm not sure how to do this conditional branch logic. Right now, the code calls the Dts.Results.Success / Failure. The problem, however, is Failure is exactly that... which doesn't result in the graceful exit I'm looking for.

Anyone have any ideas?

Thanks in advance.

View 7 Replies View Related

How To Write Condition In The Conditional Split Control In SSIS

Aug 25, 2006

HI i need to write the Condition for Insert and Update Reccord depending upon the Prod_ID. How to write the Follwing condtion in the Condition Split? pls Anyone give me the Solution?

 

 "  if   Prod_ID  Exist then  UPDATE  Records

    if Prod_ID   Not EXIST then INSERT Records "

 

 how to write the above conditon in the Condional Split?

Thanks  &  Regards,

Jeyakumar.M

chennai

 

 

View 10 Replies View Related

Data Conversion/Population

Aug 24, 2001

Can i write a Stored Procedure so as to enter the data in the tables in bulk. Say we have an application through which we can enter the data in some 4-5 tables. For actual testing we need to have a large amount of data being populated in all these tables and its not feasible to do this through the application in a short time. Is there any way out for such a situation so that we can enter the valid data with different confitions in the tables ?

Thanx,

View 1 Replies View Related

How To Stop Incremental Population

Feb 7, 2007

i have a catalog and add directory which has 10,000 documents and all are index but if i add 1000 documents to that directory and i don't want those 1000 documents to be indexed. i want only previous 10,000 index document and don't want to new document to be indexed. is there any way can stop the new document to be indexed, please let me it's bit urgent.
Thanking you in anticipation

View 2 Replies View Related

Surrogate Key Population On A Select Into

May 19, 2008

I am performing a Select Into from a #table into a real table that has a surrogate key. If this is in a transaction (or not in one) am I guaranteed that the records inserted will be sequential surrogate key ids?

Select * into REALTABLE from MYPOUNDTABLE --40 rows

Can I assume that if the first one inserted is id 32 that the last one is 72?

View 5 Replies View Related

Surrogate Key Population On A Select Into

May 19, 2008

I am performing a Select Into from a #table into a real table that has a surrogate key. If this is in a transaction (or not in one) am I guaranteed that the records inserted will be sequential surrogate key ids?

Select * into REALTABLE from MYPOUNDTABLE --40 rows

Can I assume that if the first one inserted is id 32 that the last one is 72?

View 6 Replies View Related

Error During Full-text Population

Feb 16, 2007

I'm using Full-text in various databases on my servers (SQL2005 on W2K3). On a few databases the Full-text population ends with the error:

'Error '0x80030050' occurred during full-text index population for table or indexed view '[database].[dbo].[table]' (table or indexed view ID '1714105147', database ID '9'), full-text key value 0x00015EE1. Failed to index the row.'

The next log-line lets me know the name of the dll that caused the problem:

The component 'offfilt.dll' reported error while indexing. Component path 'C:WINDOWSsystem32offfilt.dll'.

There's one solution I read about, but that one is not the case here. That sollution states that this problem occurs when de datatype is not the same as the filetype (e.g. datatype is pdf, documenttype is doc).

What can be the problem here?

Thanks.

View 5 Replies View Related

How To Check Status Of Incremental Population?

Jun 1, 2008

Hi,



I have a full text index created on a table with PK, text column and timestamp column. The table has 10 million rows. I tried one time full population and CPU spiked so after couple of hours i stopped full population.



Now since i have a timestamp column in the table I want to do a incremental population.



But when I run a select



SELECT * FROM sys.fulltext_indexes



The incremental_timestamp column is showing value 0x0000000000000000


How do I find how long will it take for incremental population to complete?

Thanks,
Yogesh

View 4 Replies View Related

Conditional Subscription / Conditional Execution Of Report

Mar 7, 2008



Hello everyone,

Is there a way in order to execute a subscribed report based on a certain criteria?

For example, let's say send a report to users when data exist on the report else if no data is returned by the query
executed by the report then it will not send the report to users.

My current situation here is that users tend to say that this should not happen, since no pertinent information is contained in the report, why would they receive email with blank data in it.


Any help or suggestions will be much appreciated.

Thanks,
Larry

View 6 Replies View Related

Full Text Index Population Tuning

Apr 11, 2007

hello,
I'm looking for a way to populate my index on insertion but not on updates.
I tried each possible value for CHANGE_TRACKING MANUAL|AUTO|OFF and it automatically takes every changes that have been made before in account. is there a way to "flag" the rows that I don't want the server to re-index (i.e. updated rows).

Thanks for reading, any help is welcome.

View 1 Replies View Related

Analysis :: Add Population Data In SSAS Cube

Aug 7, 2015

I want to implement population data in sales cube.

Fact table has customer code which is foreign key of Customer master dimension which in turn is linked to census data dimension. Census data dimension have city wise population data having foreign keys of zone and state.

We want to add population data in fact table.

View 3 Replies View Related

Show Columns On Both Matrix Regardless Of Population Of Data

May 1, 2008



I have used two matrix in one of my reports. One matrix is right above other. Both matrix's columns are allocated for month name. I.e there are 12 columns for each month of the year for each matrix.
column name of the second matrix was hidden. so end user can see only first matrix column name and corresponding data in each matrix.
But the problem is now, when there is no data for perticular month in first matrix, thats month's column does not appear at all.
Lets say there is no data for November in first matrix. so Novem column is missing in first mtrix now. but still Novem column is shown on the second matrix as it has some data, although column name is not shown. I wonder how I can show all the columns of both matrix regardless of population of data.

Thanks

View 1 Replies View Related

Population Size In Naive Bayesian Algorithm

Feb 6, 2007

Hi,

I am working with Naive Bayesian Algorithm and I do not understand why if the original table has 8.000 rcds the size of the entire population shown in Hystogram viewer is only of 2000.

Do you have any answer?

View 1 Replies View Related

SQL Server 2012 :: Data Statistics For Population And Distribution

Aug 19, 2015

I have been asked to create a report for one of our clients. The report is pretty basic but I am concerned about the overheads with my planned approach.The report is at a table and field grain to include values for:

* Min column value
* Max column value
* Number of discrete values
* Number of populated values (not NULL)

My current plan is to have a cursor over a limited view of sys.tables and sys.columns that will run a dynamic SQL query to import the results into a table that I can then output.There must be a better way of doing this and I don't have access to any DQS services.

View 1 Replies View Related

SP To Determine Layout, Population And Sample Data In Table(s)

Nov 1, 2007

Hi! I am new to SQL Server... looking for some veteran assistance.

"Data Integrity Report"

I need a Stored Procedure that takes a table name as a parameter and returns a cursor suitable as a data source for a pre-built Report Services report (I guess Report Services would call the SP?).

The cursor/report needs to have the following columns:



Ordinal_Position (I.E. Column number)
Column_Name
Number Of Blank Rows (how many missing values for this column in this table)
Difference (Between total rowcount and population of this column)

Data_Type

Column_Length (either Character_Maximum_Length or the numeric widths rolled up with COALESCE?)
Sample Data (The contents of the "first" row in the table, based on a TOP(1) and ORDER BY xxx)
The report should look like this (for a table with 100 rows):

Col Num Col Name # Blanks Difference Data Type Col Length Sample Data
1 Name 12 88 varchar 30 Sally Smith
2 Address 34 66 varchar 45 123 Main St Apt 45
3 Acct_ID 0 100 varchar 4 AB12345

Using the "Information_Schema.Columns" I can get everything I need except for #3 (blanks count) and #7 (Sample data).

Is it possible to do this as 1 query, with a CTE or APPLY or something, or do I need to do a table variable based on the Information_Schema and then use dynamic SQL and row-by-row COUNT(*) for each column? And the same for the Sample Data.

Sorry for the long post, and thanks in advance!
John

View 1 Replies View Related

Population Of Dimension Table Takes Long Time

May 26, 2008



Hi,

The scenario is the data comes from various sources and its staged into staging database. From this staging database it goes into data warehouse database. Everyday this staging database is truncated and repopulated from various sources.
I've a dimension table called DimCustomers which consists of around 300,000 rows and has lots of different types of SCD columns. It takes around 4-5 hours to load data from staging to this dimension table. Currently I'm using a For Loop container which uses a store proc to extract 15000 rows each time and populate my dimension tables. First couple of loops it goes off quickly but as and when the number reaches half of the count it slows down and hence it takes around 4-5 hours to load data.

What would be the best approach to populate this kind of dimension table.

Thanks

View 7 Replies View Related

Issue With SSRS Report Exporting To Excel With The Matrix Control Inside The Table Control

Jan 27, 2008

Hi All,
I am placing a Matrix inside the table control for grouping requirements,but when we export the report to the Excel, the contents inside the table cell are ignored. Is there any way to get the full report exported, as per the Requirement.Please help me with this issue.

With Thanks
M.Mahendra

View 5 Replies View Related

How Long Takes To Do Resume Full Text Index Population

Aug 11, 2012

I have a table having 220 lakhs of records and one of the column is Full Text enabled.We have used ContainsTable() to search for data, but we are unable to get results as expected. so we done rebuild.During Index Rebuild, population is failed.I have found this error in error log and it is saying to do resume population.So I want to know how long it takes to complete Resume population process.

look at the below more details about FT Index table.

Row count - 22155112

Index space - 1,903.250 MB (1.9 GB)

Data space - 87,552.258 MB (87 GB)

sqlserver2008 R2

and the below query we have used

HTML Code:
SELECT Distinct top 50 cal.case_id,cal.cas_details
From g_case_action_log cal (READUNCOMMITTED)
inner join containstable(es.g_case_action_log, cas_details,
' ("235355" OR "<br>235355" OR "235355<br> ") ') as key_tbl on cal.log_id = key_tbl.[key]
Where cal.product_id = 38810 ORDER By cal.case_id DESC

This query is not going to search in recent inserted/updated rows. this is the actual issue we are facing.

how to fix this error and if population need to be resume, then how long takes to do resume population.

View 1 Replies View Related

MSFTE Errors During Initial Full-text Index Population

Jun 1, 2007

Error log:
full-text crawl logs for details.
2007-06-01 07:33:55.63 spid25s Error: 7683, Severity: 16, State: 1.
2007-06-01 07:33:55.63 spid25s Errors were encountered during full-text index population for table or indexed view '[XXXX].[dbo].[RECORDS]', database 'XXXX' (table or indexed view ID '738101670', database ID '17'). Please see full-text crawl logs for details.
2007-06-01 07:33:55.63 spid25s Changing the status to MERGE for full-text catalog "XXXX" (21) in database "XXX" (17). This is an informational message only. No user action is required.

This happens for every table that has membership in the full text storage, it is not specific to a database or column type

Scrawl Log:
2007-06-01 07:33:00.57 spid23s Informational: Full-text Full population initialized for table or indexed view '[XXXX].[dbo].[ATTACHMENTS]' (table or indexed view ID '517576882', database ID '17'). Population sub-tasks: 1.
2007-06-01 07:33:36.20 spid23s Error '0x80070003' occurred during full-text index population for table or indexed view '[XXXX].[dbo].[RECORDS]' (table or indexed view ID '738101670', database ID '17'), full-text key value 0x00002B59. Attempt will be made to reindex it.
2007-06-01 07:33:55.63 spid25s Informational: Full-text retry pass of Full population completed for table or indexed view '[XXXX].[dbo].[RECORDS]' (table or indexed view ID '738101670', database ID '17'). Number of retry documents processed: 31899. Number of documents failed: 31899.
2007-06-01 07:33:55.63 spid25s Changing the status to MERGE for full-text catalog "XXXX" (21) in database "XXXX" (17). This is an informational message only. No user action is required.
2007-06-01 07:33:56.59 spid23s Informational: Full-text Auto population initialized for table or indexed view '[XXX].[dbo].[RECORDS]' (table or indexed view ID '738101670', database ID '17'). Population sub-tasks: 1.

Thanks for you feedback.

View 4 Replies View Related

Is It Possible To Embbed And Ocx Control On A Report Or Some Sort Of Interactive Control Like A Flash.ocx?

Oct 25, 2007

does any one have and example of how to embedd a flash swf file onto a report.??? Is it possable? any examples would be helpful.

View 1 Replies View Related

SQL Server 2012 :: Asynchronous Cursor Population Slow For Large Result Sets

Jul 2, 2015

so async cursor population is supposed to create the cursor and return the cursor id quickly, while the server works on async populating the results. For a keyset-driven cursor, SQL Server stores the key sets in tempdb, which it then uses to fetch data for cursor results. Anyway, this works fine for smaller tables, but I'm finding for large result sets, the async cursor population is very slow and indeed seems to approximate synchronous time. The wait stat I get while it is running (supposedly asynchronously) is TRANSACTION_MUTEX.

Example:
--enable async cursor
exec dbo.sp_configure 'cursor threshold', 0; reconfigure;
declare @cursor int, @stmt nvarchar(max), @scrollopt int, @ccopt int, @rowcount int;
--example of giant result set
set @stmt = 'select * from sys.all_objects o1, sys.all_objects o1';

[code]...

Note that using the SQL "select * from sys.all_objects o1" is much faster than "select * from sys.all_objects o1, sys.all_objects o2". However, if cursor population is async, I'd expect the time to return a cursor id to be similar between the two.

View 7 Replies View Related

Gridview And DropDownList

Oct 18, 2006

Hello:I have add a DropDownList to my GridView and binded the dropdownlist to a field from a select statement in the SQLDataSource. I have EnabledEditing for my GridView. The GridView is populated with information from the select statement. Some of the information returned from the select statement is null. The field where the dropdownlist is binded it is null in some cases and does not have a value that is in the dropdownlist so I get and error when I attempt to do an update. 'DropDownList1' has a SelectedValue which is invalid because it does not exist in the list of items.Parameter name: value Is there a way to get around this besides initializing all the columns in the table that are going to be binded to a dropdownlist to a value in the dropdownlist?

View 1 Replies View Related

Sqldatasource And Dropdownlist

Nov 8, 2006

 
Hi,
I have sqldatasource that i set up in VS2005.  i have a dropdownlist using this source.  Data is added to the db from a different app and i want this dropdownlist to use the latest data on a page refresh. 
However i can not refresh the sqldatasource - the dropdownlist does not show the latest additions to the db - i  hae to rebuild to see them.  i tried turnning 'enable caching' and 'enable viewstate' to false but no luck.
How is this done.
 
Thanks.
 
 

View 1 Replies View Related

Can You Use Substring In ASP.NET On A DropDownList ?

Oct 26, 2007

I'm using the GridView to display some accounting infromation. I have a project where I have a 14 character control number. I would like to have a dropdown list to select the account classification of records to be displayed. The accounting classification is the first two characters of the control number.  So the dropdown list needs to show unique first two characters and the GridView will be filtered on these two characters.  I have been trying to use "substring" in the ASP.NET code; not even sure you can.
Any suggestions on how to accomplish this would be greatly appreciated.  See code below:
<asp:DropDownList ID="DropDownList1" runat="server" AutoPostBack="True" DataSourceID="SqlDataSource2"
DataTextField="control_num" DataValueField="control_num">
</asp:DropDownList><asp:SqlDataSource ID="SqlDataSource2" runat="server" ConnectionString="<%$ ConnectionStrings:GPCRReportsConnectionString %>"
SelectCommand="SELECT DISTINCT [substring(control_num,1,2)] FROM [Request]"></asp:SqlDataSource>
ERROR: Invalid column name 'substring(control_num,1,2)'.

View 6 Replies View Related

Not Inserting Dropdownlist

Jan 30, 2008

Hi folks,
I'm in trouble getting an dropdownlist inserting its selected value into an .mdb
I'll insert my datasource code. There is another dropdownlist in this formview working good.
There is a datafield ID_Org_Einheit in the database to gather the value.
Could you please look this over?
Many thanks
Rosi
 
 
This is the dropdownlist
<asp:DropDownList ID="DDL_Org_alle" runat="server" DataSourceID="SDS_Org_alle" DataTextField="OE_gegliedert"
DataValueField="ID_org">
</asp:DropDownList>
and the datasource
<asp:SqlDataSource ID="SDS_insert_FB_log" runat="server" ConnectionString="<%$ ConnectionStrings:FahrtenbuchConnectionString %>"
 
InsertCommand="INSERT INTO tab_Fahrtenbuch_log([Datum_Eintragung], [Fahrer], [ID_Org_Einheit], [pol_Kennzeichen], [ID_Einsatzzweck], [Strecke_von], [Strecke_bis], [Zeit_von], [Zeit_bis], [km_von], [km_bis]) VALUES (@Datum_Eintragung,@Fahrer,@ID_Org_Einheit,@pol_Kennzeichen,@ID_Einsatzzweck,@Strecke_von,@Strecke_bis,@Zeit_von,@Zeit_bis,@km_von,@km_bis)" ProviderName="<%$ ConnectionStrings:FahrtenbuchConnectionString.ProviderName %>"
SelectCommand="SELECT Datum_Eintragung, Fahrer, ID_Einsatzzweck, Strecke_von, Strecke_bis, pol_Kennzeichen, ID_Org_Einheit, Zeit_von, Zeit_bis, Bemerkung, km_von, km_bis FROM tab_Fahrtenbuch_log">
<InsertParameters>
<asp:FormParameter FormField="Datum_EintragungTextBox" Name="Datum_Eintragung"/>
<asp:FormParameter FormField="FahrerEintragTextBox" Name="Fahrer"/>
<asp:FormParameter FormField="DDL_Org_alle" DefaultValue="1" Name="ID_Org_Einheit"/>
 
<asp:FormParameter FormField="polKennzTextBox" Name="pol_Kennzeichen"/>
<asp:FormParameter FormField="DDL_Einsatzzweck" DefaultValue="1" Name="ID_Einsatzzweck" Direction="Input" Size="3" /><asp:FormParameter FormField="StartTextBox" Name="Strecke_von"/> <asp:FormParameter FormField="ZielTextBox" Name="Strecke_bis"/>
 
<asp:FormParameter FormField="AbfahrtTextBox" Name="Zeit_von"/>
<asp:FormParameter FormField="AnkunftTextBox" Name="Zeit_bis"/><asp:FormParameter FormField="kmFahrtBeginnTextBox" Name="km_von"/> <asp:FormParameter FormField="kmFahrtEndeTextBox" Name="km_bis"/>
 
</InsertParameters></asp:SqlDataSource>
 

View 3 Replies View Related

My DropDownList Won't Declare?

Mar 3, 2008

 Need a little help! I am trying to insert ListItems values from a DropDownList into a database table. However in the code behind I am continuosly met with the error Name 'ddltest' is not declared. As you can see from the code below ddltest is an object with the ID ddltest. What am I doing wrong?
 Protected Sub ddltest_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs)Dim MyVar As String = ddltest.SelectedItem.Value
 
If MyVar = "" Then
ErrorMessage.Text = "Please select a test"
Else
'Insert selection into databaseDim oConnection As New SqlConnection
Dim oCommand As SqlCommand
Dim sConnString As String
Dim sSQL As String
sConnString = "Data Source=.SQLEXPRESS;AttachDbFilename=|DataDirectory|xxxxx.mdf;Integrated Security=True;User Instance=false"oConnection = New SqlConnection(sConnString)
sSQL = "INSERT INTO testDB(Myxxxx) Values (@Myxxxx)"
oConnection.Open()oCommand = New SqlCommand(sSQL, oConnection)oCommand.Parameters.Add(New SqlParameter("@Myxxxx", MyVar))
oCommand.ExecuteNonQuery()
oConnection.Close()
ErrorMessage.Text = "You selected " & MyVar & " and it has been added to the database."
End If
End Sub
 
<asp:TemplateField HeaderText="Test">
<EditItemTemplate>
 
<asp:DropDownList ID="ddltest" runat="server" AutoPostBack="True" OnSelectedIndexChanged="ddltest_SelectedIndexChanged" >
<asp:ListItem Selected="True" Value="" ><-- Please Select a test --></asp:ListItem><asp:ListItem Value="1">1</asp:ListItem>
<asp:ListItem Value="2">2</asp:ListItem>
<asp:ListItem Value="3">3</asp:ListItem>
<asp:ListItem Value="4">4</asp:ListItem>
<asp:ListItem Value="5" >5</asp:ListItem>
</asp:DropDownList>
 
</EditItemTemplate>
</asp:TemplateField>

View 7 Replies View Related

Fill Dropdownlist

May 7, 2008

hi,
how can i fill dropdownlist through code not through visit.and i need to know which is fastest and easy way for web application throught this below query.
cmd.Connection = conn
conn.Open()Dim ds As New DataSet
cmd.CommandText = "SELECT Emp_Name,Emp_ID FROM Employee "
da.Fill(ds, "data")
cmd.ExecuteNonQuery()
conn.Close()

View 4 Replies View Related

Dropdownlist -default Value!!

Feb 3, 2004

hi ,

need your help please

I have got a dropdownlist which is getting it's items and values from the table with in SQL server , everything works fine.

I just want to be able to select default item , so when the page is loaded the dropdown list default will be that selected item.

as an exmple if the drop downlist items and values are as follow

item ----> value
---------------------
city -----> 1
tokyo -----> 2
london ------>3

these info is imported from the database
and I want by default tokyo to be selected

many thanks

M


----------------------------------------
here is my code:

Dim sqlConnection As SqlConnection
Dim sqlDataAdapter As SqlDataAdapter
Dim sqlCommand As SqlCommand
Dim dataSet As DataSet
Dim dataTable As DataTable


sqlConnection = New SqlConnection("user id=sa;password=testfirm;database=ken_live;server=csfirm03")

'pass the stored proc name and SqlConnection
sqlCommand = New SqlCommand("Select * From _aci",sqlConnection)

'instantiate SqlAdapter and DataSet
sqlDataAdapter = New SqlDataAdapter(sqlCommand)
dataSet = New DataSet()

'populate the DataSet
sqlDataAdapter.Fill(dataSet, "AA")

'apply sort to the DefaultView to sort by CompanyName
dataSet.Tables(0).DefaultView.Sort = "bsheet"
city.DataSource = dataSet.Tables("AA").DefaultView

city.DataTextField ="bsheet" ' what to display
city.DataValueField ="bsheet" ' what to set as value

city.DataBind()

View 15 Replies View Related

Inserting DropDownList Value Into DB

Jan 16, 2006

Hi... im trying to insert whatever value a user selects from a drop down list box into a database.
So I have already stated that there are 5 different options (eg. 1,2,3,4,5) so I want it that when someone selects '2' and then clicks a button it inserts '2' into a db... I tried the following (DDL is the id of the drop down list box) :
Dim myCommand As SqlCommandDim objUsers As SqlTransactionDim strnumber As String = DDL.SelectedValueconnstring = System.Configuration.ConfigurationManager.AppSettings("ConnectionString")conUsers = New SqlConnection(connstring)conUsers.Open()objUsers = conUsers.BeginTransaction
"INSERT INTO tblsomething (number) VALUES (strnumber)"
myCommand = New SqlCommand(strSQL, conUsers)myCommand.Transaction = objUsersmyCommand.ExecuteNonQuery()objUsers.Commit()conUsers.Close()
 - Anyway suffice to say that this isnt working sssooooo...... help. Please

View 3 Replies View Related







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