DataSource Controls :: How To Extract Specified Data From The Column

Apr 9, 2010

i have a data column which contains data in the folowing format :

12345-ABC-1234
1234-AB-123
123-A-12

how can i retrive columns based on the characters between the hyphens

e.g. only those columns which contain AB between hyphens(-)..

View 2 Replies


Similar Messages:

DataSource Controls :: Extract Selected Data From Column?

Apr 15, 2010

i hve a data column containing data in this format...

1234-ab-1234
123-xy-123
12-ab-12
123-xy-123
1234-a-1234
12-s-1234
1234-xy-1234

how can i extract data between hyphens (ab, xy, a, s).. i need to extract distinct data only...

View 4 Replies

Forms Data Controls :: How To Extract Value From A Dropdownlist After Bind 7 Column Name In A Dropdownlist

Mar 29, 2011

I have a table and 7 column name.

I bind the 7 column name in one dropdownlist.

Now the problem is,how do I extract the data value in a dropdownlist?

For example,

Dropdownlist contain 7 column name

-subject_name

-subject_code

-venue

-time

-seat_no

-admission_no

-subject_id

when I click the subject_name,I want it to appear in a gridview

Example

Math|9.00-10.00|Hall|18|09090J|...

Below is my current codes which I have a problem.

protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
{
SqlConnection conn = new SqlConnection("Data Source= EN\SQLEXPRESS;" + "Initial Catalog=ms;Integrated Security=SSPI");
SqlDataAdapter adapSel;
string mySQL = "SELECT '" + dd_list.SelectedValue+ "' FROM examtimetable ";
adapSel = new SqlDataAdapter(mySQL, conn);
conn.Open();
DataSet dsSel = new DataSet();
adapSel.Fill(dsSel);
GridView1.DataSource = dsSel;
GridView1.DataBind();
conn.Close();
}
Previously I have bind 7 column name in my dropdownlist
protected void Page_Load(object sender, EventArgs e)
{
if (Page.IsPostBack == false)
{
SqlConnection conn = new SqlConnection("Data Source= EN\SQLEXPRESS;" + "Initial Catalog=ms;Integrated Security=SSPI");
SqlCommand sqlCmd = new SqlCommand("select column_name from information_schema.columns where table_name='examtimetable' and COLUMN_NAME not like '%ID'", conn);
conn.Open();
SqlDataReader ds;
ds = sqlCmd.ExecuteReader();
dd_list.Items.Clear();
dd_list.DataSource = ds;
dd_list.DataTextField = "Column_Name";
dd_list.DataValueField = "Column_Name";
dd_list.DataBind();
dd_list.Items.Insert(0, "Select Option");
ds.Close();
conn.Close();
}
}

View 10 Replies

DataSource Controls :: How To Extract First 3 Digits From A DropDownMenu

Apr 21, 2010

I have a web form where there are couple of DDL's; DDL1 and DDL2 respectively. I want the DDL2 to be populated based on what option is selected in DDL1. Also I just want to extract the first three digits of the value selected in DDL1 and use it in the WHERE clause of the SQL query used to generate DDL2.

My prob is that I am not able to extract the first three digits out of DDL1 to be compared to another field from the DB in the WHERE clause of the SQL query for DDL2.

Here is my code for DDL2

[Code]....

View 15 Replies

DataSource Controls :: Extract Numerical Digits From A String?

Mar 18, 2010

I need to extract numerical digits from a string using sql in a select statement

"Customer is eligible for Balance Billing with $10 credit on the next bill. Fixed monthly Balance Billing amount is $141.38. Offer is valid till the end of March 31, 2010."

I need ot extract 141.38 from teh above text.The length of the decimal can vary

View 5 Replies

Forms Data Controls :: Updating The Datasource / Mark All The Values In The Binding Column Of Datasource If Checkbox In Headertemplate Is Checked?

Sep 29, 2010

Scenario:
I am creating a custom gridview control which has a custom CheckBoxTemplateField column (deriving from TemplateField class). This template field column has custom Checkboxheadertemplate (implementing ITemplate) and CheckboxItemTemplate (also implementing ITemplate). In InstantiateIn method of both templates (header as well as Item template), I am adding a checkbox control which has Autopostback = true.

My requirement is:
I want to mark all the values in the binding column of datasource if checkbox in headertemplate is checked. I dont want to mark only rows visible on grid. I WANT TO MARK ALL ROWS IN DATASOURCE. I want to do this in _CheckedChanged event of checkbox in header template.

Problem I am facing: When I check/uncheck the checkbox in header, it postbacks. so in OnCheckedChanged event, gridview's datasource is null. Secondly, in any event of gridview, I could access only those rows of datasource for which corresponding rows are visible in gridview through Gridviewrow.DataItem property. But I want to set it for all rows in datasource.

View 5 Replies

DataSource Controls :: Uniquely Extract Tables From Database Schema?

Jun 11, 2010

I am looking for a fast way (either by script or Query statements) that would enable me uniquely extract some tables from my database schema.

The tables I wish to extract have some unique columns like x and y coordinate columns and i want to extract only the tables that have these coulmns in them.

My database schema is very large with 100s of tables that i cant just go through the tables one by one.

View 4 Replies

DataSource Controls :: Extract Specific Word In Sql If The Field Contain Comma?

Feb 24, 2010

how can i split the frist word in sql if the field contain ',' otherwise, only show the data value.

if the field is 'A,B,C'

I would like to select A as a result.

View 3 Replies

SQL Server :: Extract Words From One Column?

Mar 21, 2011

I am having one column named Location in My MS SQL 2008 Database and the values in the Column is like "Region/State/City" region, city and states are saperated by forward slash.

In that column some times City is given and somtime it is not provided means only Region and state.

Now, i need to extract that Region, state and city from one column to a view and in view there should be three columns State ,City and region.

I have tried the SUBString but it works on no. of characters but for different city and regions the no.

View 3 Replies

SQL Server :: Extract Part Of A String / Insert This Column Into Table2

Mar 29, 2011

I have a table1 with first column having: usjim, uskim, uspeter, john ....

I need to insert this column into table2 excluding us if contains any ( extract substring basically)

I have tried doing this but doesn't work

[code]....

View 2 Replies

DataSource Controls :: Accessing Specific Column In Database With Column ID With Table Adaptor

Jan 6, 2010

I'm currectly tryin to access a specific value in my database in a specific column. I'm tryin to use the primary key of the table to access the actual value in the row of that ID.

The current code:

[Code]....

Just iterates through the table and looking for any row with the boolean 'checkin' value is True, then it takes the 'id' value of that row and stores it into an array. Is there a way that I can access a another entry, and only that entry, in the table with the 'id' stored in the array?

Like if my data base contained and int, primarykey, `id` value, a boolean, `checkedin` value, and a `time` value, is there a way to access, lets say, the row with `id` equalling 3 and and the checkIn value from that row?

View 2 Replies

DataSource Controls :: Split One Data Column Into Many?

Aug 4, 2010

I've a database table contains survey questions and answers. But the problem is both 'question' and 'answer' are saved in the same column(like below).

SubmissionDate Submission
2010-02-15 14:53:59.657 ***What's your pet's name?*** Lili ***Tell us about yourself*** I'm a teacher
2010-02-15 14:53:59.657 ***What's your pet's name?*** Lucy ***Tell us about yourself*** I'm a five star cook

I'd like to use a simple datagrid to display the survey result, but I need to separate the submission column into multiple columns ('question' as column name, 'answer' as data) the number of questions or questions being asked are different for each survey so they are not fixed. Is it even possible to get something like this below in a gridview?

SubmissionDate What's your pet's name? Tell us about yourself
2010-02-15 14:53:59.657 Lili I'm a teacher
2010-02-15 14:53:59.657 Lucy I'm a five star cook

View 11 Replies

DataSource Controls :: How To Select Column Value From Grid And Hide A Column

Oct 19, 2010

I'm trying to retreive a column value from gridview5 to use it in a query to display resuls in gridview, Also how do you hide a column in the grid?

Where (p.Link_ID Like GridView5.?

[code]....

View 3 Replies

DataSource Controls :: Move 1 Column Values To Another Column In Datatable?

Mar 31, 2010

i have a datatable with several columns and rows. now i want to copy the last column fully (all rows) and create the new column with that values.

it means last column values sholud be moved to new column (now this is the last column).

View 2 Replies

DataSource Controls :: Changing Data Of Same Value In The Same Column Of A Datatable?

Mar 18, 2010

I have a datatable that looks as follows:

Make,Ford,0
Model,Fusion,0
Year,2010,0
Make,Ford,1
Model,Focus,1
Year,2010,1

I'd like to loop through each row and replace all the values of the same type in the 3rd column with a different value.

So for example I would change all the 0 to 1234 and all the 1 to 1235. So I'd end up with:

Make,Ford,1234
Model,Fusion,1234
Year,2010,1234
Make,Ford,1235
Model,Focus,1235
Year,2010,1235

Whats the best way to do that ?

View 2 Replies

DataSource Controls :: Display Part Of The Data In A Column?

May 1, 2010

I want to display only the last four digits of a credit card number in a formview bound label

Can someone explain how I could edit my select statement to only display the last 4 out of 16 characters from that column?

View 3 Replies

DataSource Controls :: Concat Column Data In Single Row For Group Data?

Mar 5, 2010

I have made a query based upon that the output is come as follow:-

[Code]....

Output should be like this:-

[Code]....

Means we need to concat all serial no in one row itself for a single group of data.

View 5 Replies

DataSource Controls :: Excel To SQL Column Data Type Conversions?

Feb 12, 2010

I want to import a spreadsheet into SQL. The import/export wizard forces Column A to be a double. In Excel, the column is formatted as text. When I try to convert from double to text/varchar/nvarchar, the import process fails. Why can't I convert a number to text in SQL?

View 3 Replies

DataSource Controls :: Set Or Reset A Boolean Column In A Data Table?

Mar 20, 2010

I have defined some binary bit columns in an SQL database table to indicate yes/no conditions, but I don't know how to set or reset them. I tried to use "profile.Volunteer = 0;" C# code in an event handler to reset a voluntary state for the Profile table of members, but what I got back was an error message that said, "Constant value '0' cannot be converted to a bool'. So, if a '0' cannot be used to reset a boolean value, what can be used?

View 2 Replies

DataSource Controls :: How To Change A Table Column Data Type

Jan 21, 2010

I attempted to change a table columns data type and in the process caused a lot of issues. I had a date column in one of my tables and stupidly changed it from varchar to date. When I tried to run queries on it I keep getting the 'cant find column 3 error'. Now that tables structure is :

[Code]...

So column 4 is actually the date column. All other queries work for this table. I then tried to change it back and then copied all data to a new table and now I am using the new table and converting the dates as needed but I am still getting the error.

SELECT * FROM postlinks WHERE postlinks.date >= CONVERT(datetime,CONVERT(varchar(10),GetDate(),112))

View 16 Replies

DataSource Controls :: How To Find Column Names Without Selecting Data

Jun 14, 2010

I am writting a custom class with which I manipulate the data for my website. I was wondering if there is a way to connect to a database and retreive the column names for a given table with out sellecting any data in the table.

Currently I am using an sql select and connection string to create an SqlComman object. Then I use the command object to create a SqlDataAdapter object which I use to fill a DataSet. At the end of all that I am able to retrieve the column names but I have select data and retreived data.

View 2 Replies

DataSource Controls :: LINQ - Select Column In Data Table?

Feb 9, 2010

Mmy data table has four columns. How can I get only selected columns name?

View 5 Replies

DataSource Controls :: How To Select A Column With The Latest Datetime Data Type

Jun 14, 2010

How do I select a column with the latest "datetime" data type, in Visual Web Developer 2008, ASP.NET 3.5 ?

In the config data source WHERE option my options are greater than cookie, control, etc... but I would like to select where the datetime is the latest in the table.

View 5 Replies

DataSource Controls :: How To Show Multiple Column Data In Dropdownlist From Database

Jun 3, 2010

I want to retrieve data from various column,which may some have blank value, so my problem is i want to retrieve only filled column(not any blank column) from multiple column.. I am doing this (given below) but it didn't return anything...

Column Name Value

Restaurant Restaurant

Spa Spa

Parking

Bar_Pub

Fitness_Center_Gym Fitness_Center_Gym

OleDbCommand cmd1 = new OleDbCommand("select nID Restaurant+''+Spa+''+Parking+''+Bar_Pub+''+Fitness_Center_Gym AS Facility from add_property where ncity='" + DropDownList1.SelectedItem.Text + "'", con);
DropDownList2.DataValueField = "nID";
DropDownList2.DataTextField = "Facility";
DropDownList2.DataBind();
con.Close();
--------------------------------------

View 9 Replies

Forms Data Controls :: Gridview Getting Headertext From Underlying Datasource Column Name?

Feb 25, 2011

I have a GridView whose AutoGenerateColumns="False". However, I don't want to statically specify the HeaderText for the columns in HTML markup. Rather I'd like to set the HeaderText to be the name of the underlying SQLDataSource column name. How can I do this?

[Code]....

View 4 Replies







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