this code is workin on one column pk but not working for more than one column Pk (Composite key).    \nwhat change should be done \n\n&#92;&#92;code start\nDataColumn[] keys=new DataColumn[1];\nkeys[0]=dataSet11.Tables["Orders"].Columns[0];\ndataSet11.Tables["Orders"].Constraints.Add(new UniqueConstraint("ck_constraint",keys[0]));\ndataSet11.Tables["Orders"].PrimaryKey=keys;\nDataRow findrow = dataSet11.Tables"Orders"].Rows.Find("200");\n&#92;&#92;code end
119819
Taht looks good, but I'd try this instead.\n\n&#92;&#92;code start\nDataColumn[] keys=new DataColumn[1];\ndataSet11.Tables["Orders"].Con... UniqueConstraint("ck_constrain...\nkeys[0]=dataSet11.Tables["Orde...\ndataSet11.Tables["Orders"].Pri...\nDataRow findrow = dataSet11.Tables"Orders"].Rows...\n&#92;&#92;code end
658398
You can select the column you want and copy it. Then go to the target (where you want to make it into rows) and select Edit -> Paste Special from the menu bar. In there, make sure you mark the box that says 'Transpose'. Voila!
492004
Since you don't want to create a blank record in the pick list table, the easiest thing would be to, after you create bind your data from the database to the dropdownlist, programmatically insert a blank in the first position of the dropdownlist like so:\n\ndropdownlist.Items.Insert(0, "                   ")\n\nJust remember this has to happen after the data is bound, otherwise the binding will remove the item that you inserted at the first index of the dropdownlist.
389535
Perhaps the data you are providing does not exist in the database and therefore nothing is deleted? I am not too good with dataadapters, you can look on the msdn website for more info on them but check the integer value of ss.ExecuteNonQuery(), this is the number of rows that have been affected. If it is greater than zero then rows have been deleting but to me it looks like you could be using the adapter incorrectly? Just double check that then if my suggestion doesnt help.
317261
The correct command would look like this:\n\nSELECT DISTINCT column1, column2\nFROM table1\nORDER BY column1, column2\n\nNote that you can append "ASC" to the end of the order by clause, but it is the default and unnecessary
294267
You have to add a new column to the data table and set its 'Expression' property. \n\neg.\nAssuming that the datatable is dtTable, name of discount column is "Discount" and name of price column is "Price"\n\ndtTable.Columns.Add("Price After Discount", GetType(System.Single), "[Price] * (100 - [Discount]) / 100")\n\nor alternatively \n\ndtTable.Columns("Price After Discount").Expression = "[Price] * (100 - [Discount]) / 100"
308173
Your going to have to set it using\n\nGridview1.Columns(<Column Number>).ItemStyle.width = 200\n\nthat should do it.\n\nI could tell you more if I knew what you were doing with the grid. Are you hiding the column? are you dynamically creating the column?\n\n5/17/2006 -- 3:50PM\nHave you set the wrap text on your gridview header to false? If you have then that would be a problem since the column cannot wrap the header and therefor will not be able to decrease the width of the column.
337871
The best way to do this is to create a query that concatinates the two fields (assuming that the title of the column and the data in each row is the same). To do this you need to created a new Primary Key on your output table which contains both the columns from the two different tables (this is known as a compound key).\n\nHope this helps.
424147
I am not a .Net person yet, but with VB6 this would work, I think :\n\nwith dgrdTest\n.row = 3 (+1 if there is a header row)\n.column = number of name column\n\ndebug.print .text\nend with\n\nNot sure if that will help with .net or if it even functions the same way.\n\nHere is a link to vb.net datagrid how-to : http://www.vb-helper.com/howto_net_datagrid.html.\n\nGoogle it : http://www.google.com/search?sourceid=navclient&ie=UTF-8&rls=GGLG,GGLG:2006-18,GGLG:en&q=vb%2enet+datagrid\n\nEnjoy!
457525
U need to call a datagrid.Update after it is deleted out of hte Grid. Or you need to re-fill the grid after u run the sqlcommand.\n\nI presonaly would create the application/webapp using the ADO.NET disconnected feature. I would create an dataset, datatable and fill the datagrid using a SqlDataAdapter. Then all you need to do is call "SqlDataAdapter.Fill" to update the Grid and to delete all you have to do is delete a row (via GUI and programaticly) and call "SqlDataAdapter.Update" to delete out of the database.\n\nEnjoy -
181520
1. As a matter of fact, you should first see what is the exact relationship between tables. Maybe in some of them you need to create FK(foreign keys).You should create PK for every table but check first the things I've writhed earlier. Anyway, a table cannot contain 2 PK at the same time... so, I think you already have at least one tables who contains ENO and RPT_NAME at the same time... be careful. \n2. you can use a Stored Procedure to update your tables (not recommended).
637734
Firstly off 'now()' isn't a function call, it's a string therefore you CANNOT use it for a default value.\n\nYou have to insert a value upon insertion to that table withe the now() string.\n\nLook Carefully about the datatypes of different Time Structures\n==============================\n\n--\n-- Lets use the test Database\n--\nmysql> use test;\nDatabase changed\n\n--\n-- Lets create a Table (temp for this example)\n--\nmysql> create table a (\n    -> x date,\n    -> y timestamp,\n    -> z datetime);\nQuery OK, 0 rows affected (0.02 sec)\n\n--\n-- Lets insert only at column x so rest are default\n--\nmysql> insert into a(x) values(now());\nQuery OK, 1 row affected (0.00 sec)\n\n--\n-- Lets insert only at column y so rest are default\n--\nmysql> insert into a(y) values(now());\nQuery OK, 1 row affected (0.00 sec)\n\n--\n-- Lets insert only at column z so rest are default\n--\nmysql> insert into a(z) values(now());\nQuery OK, 1 row affected (0.00 sec)\n\n--\n-- Lets Select everything in that table\n--\nmysql> select * from a;\n+------------+---------------------+---------------------+\n| x          | y                   | z                   |\n+------------+---------------------+---------------------+\n| 2006-06-15 | 2006-06-15 00:42:17 | NULL                |\n| NULL       | 2006-06-15 00:42:23 | NULL                |\n| NULL       | 2006-06-15 00:42:26 | 2006-06-15 00:42:26 |\n+------------+---------------------+---------------------+\n3 rows in set (0.00 sec)\n==============================\n\nNow notice what happened... TIMESTAMP by default updates the current time...,  The others are null. So change your datatype to be TIMESTAMP if you care so much about the default value.
446433
If have the same problem importanting my data.\nIn fact there are two problems, one is the separation between data columns, the other is the fact that in American notation for dates and numbers is different from the European one.\n\nIf you open a csv file  OpenOffice shows you a Text Import window.\nFirst you change the Separator options. In my case the Comma field is set, so I change it to semi-colon ; as my data are separated like that, but it might be that space or tab is the correct choice for your data.\n\nNow you have your data in correct columns.\n\nGo to the Fields lower on the pages. Each column is labelled Standard. Right clicking on the word Standard gives you various other options including several ones for the date, as well as the difference between American and European number format.\n\nIf you don't get OpenOffice to understand you, there is no other choice than to change the input file by hand or macro first.\n\nPS If a date does not contain the year, OpenOffice *always* assumes it is the present year. Therefore you have to change the date columns either by including the year explicitly, or in OpenOffice after import.\n\nPS2 I have everything automated with macros. After all it is an exercise one has to repeat often.
676292
The key to good database design is to keep a field definition discrete.  One field, or column in a table, should mean only one thing.  A table should be something which can be identified and described by its columns.  You have a table for applicants, which must show what position is applied for, and a table for positions, which must have the position-name as a column -- probably its unique identifier for each row.  Position_applied_for and Open_Position_Name should match, so your data entry form for applicants should have a drop-down list of open positions for the column position-applied-for. (If you allow free-form data entry on that column, the value won't likely match the open-position-name in your table of open positions.)  With the assurance that you can match on the name of the open position, you can create a view such as "select count (applicant_name) from applicant_table where position_applied_for = 'Secretary';"  Or you can populate a list of open-positions and the number of applicants for each by leaving out the "where" clause.
276347
Avoid using the CommandBuilder. Use parameters instead. The possible causes of the error can be :\n\n1. An error in the sqlstatement created by the commandBuilder.\n2. There can be a mapping error. The dataAdapter maps the columns in the dataset.table to the columns in the database.table . Any wrong mapping can also generate the exception.\n\nfix :\n1. Use parametrized queries. \n2. Add an explicit Data table mapping to the data adapter, so that it does not automatically create a mapping which may be erroneous.\n\neg. \n With daUsers\n                .MissingMappingAction = MissingMappingAction.Passthrough\n                .MissingSchemaAction = MissingSchemaAction.AddWithKey\n                .InsertCommand = New OleDb.OleDbCommand("INSERT INTO [Users] ([UserID], [Full Name]) Values ( ?, ?)", DbConnExclusive)\n                With .InsertCommand.Parameters\n                    .Add("UserID", OleDb.OleDbType.Integer, 0, "UserID")\n                    .Add("Full Name", OleDb.OleDbType.Integer, 0, "Full Name")\n                    End With\n                .UpdateCommand = New OleDb.OleDbCommand("UPDATE [Users] SET [Users].[Full Name] = ? WHERE [Users].[UserID] = ?", DbConnExclusive)\n                With .UpdateCommand.Parameters\n                    .Add("Full Name", OleDb.OleDbType.Integer, 0, "Full Name")\n                    .Add(New OleDb.OleDbParameter("UserID", OleDb.OleDbType.Integer, 0, ParameterDirection.Input, False, 0, 0, "UserID", DataRowVersion.Original, Nothing))\n                End With\n                .TableMappings.AddRange(New Data.Common.DataTableMapping() {New Data.Common.DataTableMapping("Users", "Users", New Data.Common.DataColumnMapping() {New Data.Common.DataColumnMapping("Full Name", "Full Name"), New Data.Common.DataColumnMapping("UserID", "UserID")})})\n            End With
57300
Create a new database, using the Database Wizard.  There, it will give you different samples.  There is probably several ready-to-run examples there to use...
12516
Yes. Each column should have a condition and mutiple values can be given in IN operator.\n\nFor ex The above one can be written like this\n\nSELECT *\nFROM TABLE_NAME\nWHERE COLUMN1 IN (col1val1,col1val2)\nAND COLUMN2 IN (col2val1,col2val2)\nAND  COLUMN3 IN (col3val1,col3val2,col3val3)