Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Help me in inserting data

Author  Topic 

Anil000
Starting Member

4 Posts

Posted - 2008-08-14 : 01:00:57
Hi,
i'm trying to insert the data into DataTable. The table consists of Two Primary Keys.
Table Structure:
StationCategoryLink
Fields: StationCode, CategoryCode
Sample Data : 1 FC
1 SD
1 AS
1 TR
2 DF
2 DG
Can you please help me in writing this query.. Its very urgent for me..
Thanks&Regards,
Anil

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-08-14 : 01:19:34
Can you post what you've tried so far? If you've not tried yet. have a look at INSERT statement in books online for assistance.
Go to Top of Page

Anil000
Starting Member

4 Posts

Posted - 2008-08-14 : 01:53:24
Hi,
actually, i'm trying to update the database table depending upon the checkbox being selected from CheckBoxList.
The code i've used for this is:
Do While (i < chkSerCat.Items.Count)
For Each itm As ListItem In chkSerCat.Items
If itm.Selected Then
InsertValues(Cdn, chkSerCat.SelectedValue, Con)
Else
lblMsg.Text = "Please enter atleast one value"
End If

Next
i = (i + 1)
Loop
Can you plese tell me, where the bug is?

Thanks&Regards,
Anil
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-08-14 : 02:10:25
is this vb?
Go to Top of Page

Anil000
Starting Member

4 Posts

Posted - 2008-08-14 : 02:22:34
Yes,
Sorry, in the code i'm trying to insert the values into database. Depending upon the StationCode value,i've to insert different category code values. This is the point where i got strucked. Just for explaining the scenario, i've posted the vb code. Can you please let me know, how to insert different CategoryCode for Same StationCode, where StationCode anad CategoryCode are both set as primary keys?

Thanks&Regards,
Anil
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-08-14 : 02:39:04
are you asking sql query or code in vb?
Go to Top of Page

Anil000
Starting Member

4 Posts

Posted - 2008-08-14 : 02:53:42
Hi,
Thanks for your response. I want SQL query for this. Can you please provide me the query..

Thanks&Regards,
Anil
Go to Top of Page
   

- Advertisement -