|
Here is what I mean:
I need to be able to substitute this ugly looking C# code:
if (attribute.Name == "Name") machinePool.Name = attribute.Value; else if (attribute.Name == "Capabilities") machinePool.Capabilities = attribute.Value; else if (attribute...
Started by LikeToCode on
, 4 posts
by 4 people.
Answer Snippets (Read the full thread at stackoverflow):
I use when I want to get property names as strings (ie, to handle a PropertyChangedEventHandler ExpressionsExTests { class NumbNut { public const string Name = "blah"; public static bool Surname.
|
|
I have a model that needs to have a field named complex and another one named type . Those are both python reserved names. According to PEP 8, I should name them complex_ and type_ respectively, but django won't allow me to have fields named with a trailing...
Started by nbv4 on
, 3 posts
by 3 people.
Answer Snippets (Read the full thread at stackoverflow):
Do you really want to use the db_column="complex" argument and call your field something else.
|
|
I have field name category_id in product table.
And also I want name field of category id as category-id.
Is there any good reasons that I should not use - in a field name?
Where can I find which character I should not use in MySQL field and table name...
Started by shin on
, 4 posts
by 4 people.
Answer Snippets (Read the full thread at stackoverflow):
The major reason against use of hyphen is that most references must then quote the field names at the reserved words list
Generally, you can use whatever name you wish as long as you wrap.
|
Ask your Facebook Friends
|
Hello,
I understand that Django won't let you save a incomplete fields in a single form created from a Model unless you do this:
tmpform = form.save(commit=False) tmpform.foo = form.cleaned_data['foo'] tmpform.save()
So I want to do this kind of thing...
Started by Paul on
, 3 posts
by 3 people.
Answer Snippets (Read the full thread at stackoverflow):
Setattr(tmpform, field, form.cleaned_data[name])
After fiddling around I think I found the syntax that seems to work for my purposes:
if formset.is_valid(): for....
Try using setattr since you don't know the name of the field.
|
|
Hello all,
I am making use of Adodb and I wish to get the field names of a result set. How do I do this?
$result = &$db->Execute($query);
The above query has executed successfully, I just don't know how to get the field names from that one row and ...
Started by Abs on
, 3 posts
by 3 people.
Answer Snippets (Read the full thread at stackoverflow):
'<br />'; }.
fields foreach($fields as $field) { echo $field.
|
|
Hello!
Working on a pre-existing program that parses an html form that has a dynamically created number of fields, and in the interest of forward-compatibility, may not even know number of mysql columns...
I imagine that this requires creating two arrays...
Started by mck66productions on
, 3 posts
by 3 people.
Answer Snippets (Read the full thread at stackoverflow):
In my experience, programmers do this because they are in control for handling queries with data we... .
Amount of PHP which uses the submitted field names to build the SQL rather than starting with a known list of field names.
|
|
Say I have a table called myTable. What is the SQL command to return all of the field names of this table? If the answer is database specific then I need SQL Server right now but would be interested in seeing the solution for other database systems as...
Started by MikeCroucher on
, 13 posts
by 13 people.
Answer Snippets (Read the full thread at stackoverflow):
Sp_help
exec sp_help 'tablename'
If you just want the column names, then
select COLUMN_NAME (from 2000) and MySQL 5:
select COLUMN_NAME from INFORMATION_SCHEMA.COLUMNS where TABLE_NAME = 'tablename from INFORMATION_SCHEMA....
|
|
A table's boolean fields can be named using the positive vs the negative...
for example, calling a field:
"ACTIVE" , 1=on / 0=off or "INACTIVE" , 0=on / 1=off
Question: Is there a proper way to make this type of table design decision, or is it arbitrary...
Started by smchacko on
, 8 posts
by 8 people.
Answer Snippets (Read the full thread at stackoverflow):
For Boolean fields....
"Is not inactive" is often cause", etc.
Don't make a bit field nullable unless you really haveI always prefer positive names, to avoid double negatives in code.
For Active/Inactive, I would name it IsActive.
|
|
I want to get a list of the field names returned from a sql statement. This can be done using a sql statement or some c# parsing code to parse the statement as a string. Can this be done easily without writing a complex parser?
For example I may want ...
Answer Snippets (Read the full thread at stackoverflow):
If you have a DataSet or DataTable , you can access its Columns property... .
Are using a SqlDataReader, which most people are, you can retrieve the field names using the following the
Reader.GetName
Method to return the column name.
|
|
I have a database full of band names.
Many of these start with "The" (eg "The Strokes").
Should I split out the "The" portion into its own DB field or keep it all as one name and handle "The" sorting/searching with SQL?
Originally I had split out "The...
Started by bandhunt on
, 4 posts
by 4 people.
Answer Snippets (Read the full thread at stackoverflow):
That standard, one method of handling this is to have two fields in the database, the official, displayed name input (assuming your UI copies the displayed name into the sort name on entry) at the expense of disk storage.
|