Changing data type of data grid view column after setting data source - c#-2.0

I am working in C#.NET. I have a datagridview and a data table has been set as its data source. Data table is the output of select query (sql) and there is a column named date whose data type is datetime. Now after setting data source I needed to change the data type of corresponding column of grid to string. Anyone know about it?

You can probably change the SQL statement so that it selects a calculated column where the value is a formatted string representation of the datetime instead of the actual "date" column itself. The SQL to do that would depend on which database product you are using.

Related

How do you convert a String to Object in Google Sheets?

So I'm making a dependent dropdown column in Google Sheets that has a bunch of different things of a type. I've named the ranges I want to use and I've got column A with those names in the dropdown. The problem is, I can't use the contents of column A to reference in column B's data verification.
E.g. I select Tech in column A, column B reads that as "Tech" when I want it to be able to reference the named range Tech. How to you convert from the string "Tech" to the named range Tech? Is there a way without using a stupidly long nested IF on every single row of B column's data verification?
Thanks in advance :)

How to display geometry datafield as Text

I'm using DELPHI with ADO and SQL Server 2014.
In our database table there is a spatial column for geometrical data. We can read and write data to this field (more info is here : https://learn.microsoft.com/de-de/sql/relational-databases/spatial/spatial-data-sql-server).
If I display this table using a TDBGRID component I got only (BLOB) shown for the content of this column in my table.
Now I want to see the content of this column. Is the any good coding to show the content of this column e.g. in a dbmemo as text.
The only solution I know is to read the field as text into a string and put this to a normal memo, I'm looking forward to get a more efficient method to access this data
You can query e.g. for Well-known text format by using SQL function like STAsText:
SELECT MyColumn.STAsText() FROM MyTable
An alternative would be fetching your data in Well-known binary data stream with parsing it on the client side to represent as text by yourself (the format is described). For fetching such stream you'd use STAsBinary function:
SELECT MyColumn.STAsBinary() FROM MyTable
Yet another option would be fetching raw geometry data as they are stored in database (as you do right now) and parse it by yourself. The format is described in the [MS-SSCLRT] document. But if I were you I would better write parser for the WKB format and fetch data in WKB format because it's quite established universal format, whilst SQL Server internal formats may change frequently.
In case your geometry includes Z and / or M values it is better to call .ToString () method.
SELECT MyColumn.ToString () FROM MyTable
The output includes Z and M values in addition to X,Y Coordinates. The .STAsText() method returns only the X,Y coordinates of your shape.

Is it possible to add BLOB Wide Memo field to a nexusdb table using a query?

I am developing a database comparing tool using delphi and nexusdb. I tried to add a BLOB Wide Memo field to a table using query. but i could not find the correct data type. i tried follow queries.
ALTER TABLE Test ADD COLUMN TestField BLOBWideMemo;
ALTER TABLE Test ADD COLUMN TestField NATIONAL CHARACTER LARGE OBJECT;
ALTER TABLE Test ADD COLUMN TestField BLOB Wide Memo;
Try this
ALTER TABLE Test ADD COLUMN TestField NCLOB

NSDate being saved as timestamp in CoreData

I currently am saving dates in my iOS application in CoreData. In Core Data, my date attribute is of type "Date". In my NSManagedObjectSubclass file, the attribute is of type: NSDate (which is fine). The date in Core Data is being stored as: 2014/05/16 14:54:51 and when I check the actual values in my SQLite3 navigator, it is being stored in the form:
421959291.293972 for the date
How do I get the above value for the date, and is there a way to convert it back to the form: 2014/05/16 14:54:51? I'm asking this because I am trying to create a dataset via a CSV file, and want to make sure that all the values that I enter in the CSV file are converted correctly by Core Data/SQLite3 into the right format.
if you are using sqlite3 as the command line tool, use the the datetime function to interpret the data, so for example
sqlite3> .schema
create table ZENTITY (... ZSTARTDATE TIMESTAMP, ...)
sqlite3> select datetime(zstartdate,'unixepoch','31 years') from ZENTITIY;
This should give the formatted timestamp stored in the entity table
The unix epoch/31 years arguments come from this stack overflow question.
Behind The Scenes: Core Data dates stored with 31 year offset?

Sorting numbers and dates in a KGrid

I have a KGrid in a Lazarus project that contains different columns with numeric, text and date data.
Sorting by the column with text data is OK but sorting by the columns containing numeric or date data does not work at all.
For instance
10,2,3,1,4,21,30 is sorted as 1,10,2,21,3,30,4 in that order.
Does anyone use KGrid and is there a way to change the grid's OnCompareCells event so that the sorting is done correctly?
Thanks.

Resources