Hi I'm using MSSQL. I set the auto generator for PK in the database. can u explain more?
thank you
User Profile
Collapse
-
-
Generating PK by using one bindingnavigator control
Hi,
I’m using VS2005 and the bindingnavigato r control. Right now I’m using 2 bindingnavigato r control (each for one table) in order to generate the new ID when I clicked the ‘add new” button. But I want to know what command and line of C# I must add to my program to generate the new ID when I clicked the “add new” button IF I want to have 1 bindingnavigato r control for both of them.
Thank you -
Binding a dataset to BindingNavigator
Hi,
I have 2 tables a parent and a child. I want to insert value from Windows Form to DB(MSSQL) in VS2005. Although I’m sending data to both of them but the new record will be generated only in parent table but not child.
At the first I thought that it is because the child does not receive the FK. But later when I tried to add FK manually(NOT parametric) I found that the new record will not be added.
Although I set... -
converting and sending data problem
Hi,
I want to send the FK from parent table to child table by getting the object with executescalar and converting the value of it to string and then to integer finally pass it to child table. The problem is that the converted data will lose the information. I mean it will become NULL.
This is how did I do:
insertCommand.C ommandText = "SELECT @@IDENTITY AS P_ID ";
SqlParameter pIDParameter... -
converting and sending data problem
Hi,
I want to send the FK from parent table to child table by getting the object with executescalar and converting the value of it to string and then to integer finally pass it to child table. The problem is that the converted data will lose the information. I mean it will become NULL.
This is how did I do:
insertCommand.C ommandText = "SELECT @@IDENTITY AS P_ID ";
SqlParameter pIDParameter... -
Creating new record in child table
I have 2 tables Patient(parent) , Battery(Child). when i gave input to it, in parent table the new record will be added but in child table the new record will not be added although I'm sending the FK to child table and also i set the automatic identity generator for it. why it will not add the new record to child table?
string connection = "Data Source=.\\SQLEX PRESS;AttachDbF ilename=\"C:\\P rogram Files\\Microsof t SQL Server\\MSSQL.1 \\MSSQL\\Data\\ AHP.mdf\";Integ rated... -
Hi. I'm connectiong C#(windows form) with MSSQL. I'm using VS 2005. the relationship is ONE2MANY.
thank youLeave a comment:
-
setting the value of FK
Hello,
I have tables which have relation. I want to know how can I set the PK value of table A which is the FK of table B while I can’t have “SET IDENTITY_INSERT BATTERY ON” for two table at one time?
Thank you, -
hi thank you for reply.
i correct the spelling but it still gave me the same error.Leave a comment:
-
error for sending(saving) data to database
Hi,
I’m using VS2005 and I’m trying to link the C# windows form to MSSQL. I used BindingNavigato r Control to read the data. After that I add sqlcommand and sqldataadapter to send the data to the database. My code is this
sqlDataAdapter1 .InsertCommand. CommandText =
"INSERT INTO SUDENT (" +
"S_ID, S_NAME, S_ADDRESS, S_PHONE" +
") VALUES ('" +... -
No because visual studio 2005 provides tableadapter so im adding this query into the tableadapter. it already has one select query but i want to add for insert and ... too.Leave a comment:
-
insert query error
Hi,
I wrote an insert query in TableAdapter and it gave me this error “Failed to get schema for this query”. The query that I wrote was this
INSERT INTO STUDENT
(S_ID, S_NAME, S_DOB, S_ADDRESS)
VALUES (@Param1,@Param 2,@Param3,@Para m4)
So how can I solve the error? Thank you -
Error for saving data
Hi,
I’m using visual studio 2005 and I’m trying to link the windows form which is developed in C# to MSSQL with bindingnavigato r control. When I want to save the record it’s telling me that NoNullAllowedEx ception was unhandled and it points at this line
this.bATTERYBin dingSource.EndE dit();
Although I gave input for all items but its telling me that some item can’t be null. Can you help me? Thank you
No activity results to display
Show More
Leave a comment: