Is there any way to create a new column in a dataset table from 2 string
column and a int column? I got an error "expecting string" from my code
below. Any help would be appreciated.
DataColumn scc1 = new
DataColumn("Cod eLength",Type.G etType("System. String"));
scc1.Expression = "iif(len(CycleL ength) > 0,CycleCode + ' - ' +
CycleLength,Cyc leCode)";
dsSchTables.Tab les["ServiceCyc le"].Columns.Add(sc c1);
dsSchTables.Acc eptChanges();
DataColumn scc2 = new
DataColumn("Cod eLengthUnit",Ty pe.GetType("Sys tem.String"));
scc1.Expression = "iif(len(CycleU nit) > 0,CodeLength + ' - ' +
CycleUnit,CodeL ength)";
dsSchTables.Tab les["ServiceCyc le"].Columns.Add(sc c2);
dsSchTables.Acc eptChanges(); 5 1363
Alpha,
I am curious about the meaning of the + '-' + in your expression?
Cor
"Alpha" <Al***@discussi ons.microsoft.c om> schreef in bericht
news:97******** *************** ***********@mic rosoft.com... Is there any way to create a new column in a dataset table from 2 string column and a int column? I got an error "expecting string" from my code below. Any help would be appreciated.
DataColumn scc1 = new DataColumn("Cod eLength",Type.G etType("System. String")); scc1.Expression = "iif(len(CycleL ength) > 0,CycleCode + ' - ' + CycleLength,Cyc leCode)"; dsSchTables.Tab les["ServiceCyc le"].Columns.Add(sc c1); dsSchTables.Acc eptChanges();
DataColumn scc2 = new DataColumn("Cod eLengthUnit",Ty pe.GetType("Sys tem.String")); scc1.Expression = "iif(len(CycleU nit) > 0,CodeLength + ' - ' + CycleUnit,CodeL ength)"; dsSchTables.Tab les["ServiceCyc le"].Columns.Add(sc c2); dsSchTables.Acc eptChanges();
That is just part of the string that I would like to display to the user to
make it easier to read the information that are consist of a Code, followed
by a '_' and the the length and unit. It would read something like this in
the combox 3k - 3000 miles
"Cor Ligthert [MVP]" wrote: Alpha,
I am curious about the meaning of the + '-' + in your expression?
Cor
"Alpha" <Al***@discussi ons.microsoft.c om> schreef in bericht news:97******** *************** ***********@mic rosoft.com... Is there any way to create a new column in a dataset table from 2 string column and a int column? I got an error "expecting string" from my code below. Any help would be appreciated.
DataColumn scc1 = new DataColumn("Cod eLength",Type.G etType("System. String")); scc1.Expression = "iif(len(CycleL ength) > 0,CycleCode + ' - ' + CycleLength,Cyc leCode)"; dsSchTables.Tab les["ServiceCyc le"].Columns.Add(sc c1); dsSchTables.Acc eptChanges();
DataColumn scc2 = new DataColumn("Cod eLengthUnit",Ty pe.GetType("Sys tem.String")); scc1.Expression = "iif(len(CycleU nit) > 0,CodeLength + ' - ' + CycleUnit,CodeL ength)"; dsSchTables.Tab les["ServiceCyc le"].Columns.Add(sc c2); dsSchTables.Acc eptChanges();
Alpha,
I don't know it, however how would the expression know that it is a
concatination if you use a system.Int32 and a system.string.
If the problem is that your first operand is an integer, than you can maybe
try the trick to add in advance a '' + (double single quote) .
Just a try and a guess
Cor
Can I fill a dataset table with a SQL SERVER View? That way I can easily
concatenate an cast the int type to string and form a column that way. What
would the sytax be if I can fill with View? I only know so far to do SQL
select from table with Select command object.
Thanks, Alpha
"Cor Ligthert [MVP]" wrote: Alpha,
I don't know it, however how would the expression know that it is a concatination if you use a system.Int32 and a system.string.
If the problem is that your first operand is an integer, than you can maybe try the trick to add in advance a '' + (double single quote) .
Just a try and a guess
Cor
I created a view in SQL SERVER and I fill the dataset by selecting the
concatenated column from the view and it works. Thanks, Alpha
"Alpha" wrote: Can I fill a dataset table with a SQL SERVER View? That way I can easily concatenate an cast the int type to string and form a column that way. What would the sytax be if I can fill with View? I only know so far to do SQL select from table with Select command object.
Thanks, Alpha
"Cor Ligthert [MVP]" wrote:
Alpha,
I don't know it, however how would the expression know that it is a concatination if you use a system.Int32 and a system.string.
If the problem is that your first operand is an integer, than you can maybe try the trick to add in advance a '' + (double single quote) .
Just a try and a guess
Cor This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Milo Woodward |
last post by:
I have some columns of data in SQL server that are of NVARCHAR(420)
format but they are dates. The dates are in DD/MM/YY format. I want to
be able to convert them to our accounting system format which is
YYYYMMDD. I know the format is strange but it will make things easier
in the long run if all of the dates are the same when working between...
|
by: Philip Sherman |
last post by:
I'm trying to copy production statistics to a test database and can't
set the column statistics for a VARGRAPHIC column to match what RUNSTATS
generated on production.
The reason code and some testing I did indicates that the length of the
low2key value is too long. It almost looks like the potential length of
data to be stored is being...
|
by: nimdez |
last post by:
Hi,
I am working on an existing code base in which a lot of data displayed
to the user is formatted in tables. Most tables are printed row-by-row
using printf() with "%s" print conversion specification for
each column (e.g. printf(%10s %25s %15s\n", pszCol1, pszCol2,
pszCol3)). My problem is that when a string is longer the column's
width,...
|
by: Daniel M. |
last post by:
I have a query that gets a string column containing a date, ex. 20040825.
If I use the property builder to format the string to 08/25/2004 it does not
work because it only accepts datetime columns. How can I convert or format
the string. Could I add a new dataset/datatable column containing the value
as I need it.
Thanks.
|
by: PeterZ |
last post by:
Hi,
In a running C# app with a datagrid control I select all rows in the
dataGrid using CTRL-A, I then paste into some other app like notepad or Word
but the column headings get left off.
Is there any way of including column headings when copying/pasting from a
running datagrid to notepad? At this stage it looks like I have to write my...
| |
by: Bob Day |
last post by:
VS 2003, sql
How do you determine the data type of a column if its value is DBNull?
1)Table:
Column1 STRING non-nullable
2) Fill to a DataSet via DataAdapter
3) dim Data_Type_Is as object
|
by: Coen |
last post by:
I have a datagrid bound to a dataset's table. I'm using a tablestyle and so I
can, with the column.format property, format numeric and date typed
datacolumns. But I need to format a column of type string. The column.format
way is of no effect then. How to make this work?
Any ideas are welcome.
Coen.
|
by: =?Utf-8?B?QmFidU1hbg==?= |
last post by:
Hi,
I have a GridView and a SqlDataSource controls on a page. The SqlDataSource
object uses stored procedures to do the CRUD operations. The DataSource has
three columns one of which - "Modified" of type DateTime - is hidden since it
should not be edited by a user. The system handles the update for this
column. So, I have hidden...
|
by: Ken |
last post by:
I'm trying to run a loop to capture column property information from a
table in my datasource. Can anybody see where this is going wrong?
Dim tbl As New DataTable
Dim col As DataColumn
Dim x As Integer
Dim colName(99) As String
Dim colType(99) As String
cn.Open()
tbl = cn.GetSchema("Orders") 'Orders is a table in the
|
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...
|
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...
| |
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
|
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...
|
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...
|
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...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
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
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |