Hi all
Here I have a problem in inseting a record into sql database. I have two tables cust & proj. In cust i have declared fields as cid int which is set as primary key & custname as varchar(30). In another table proj i have three fields. i.e. projid(primary key), proj_custid(which refernces cid from cust ie. foreign key) & proj name.
My problem is I have a form in my appication named 'project' with one combbox for customer name list which is fetched from form 'customer'. Here in the proect form project id is generated automatically.It is not be shown in the form. I have done uptil here properly. But when we save this form In the table 'proj' field 'proj_custid' should be filled with the 'cid' from the cust table. That is 'proj_custid' should be same as 'cid'
My Query runs like this
Dim sql As String = ("select cid from cust where custname= & cbxcustname.Text ")*'cbxcustname is name of combobox
sql=dr("cid")
custid=sql*declared custid as integer at the windows form generated designer code*
Inserted this custid in the insert query . But it is not working Can anyone help me out in this? This may be a very silly thing for all of you. But I am novice programmer. Please guide me
Here I have a problem in inseting a record into sql database. I have two tables cust & proj. In cust i have declared fields as cid int which is set as primary key & custname as varchar(30). In another table proj i have three fields. i.e. projid(primary key), proj_custid(which refernces cid from cust ie. foreign key) & proj name.
My problem is I have a form in my appication named 'project' with one combbox for customer name list which is fetched from form 'customer'. Here in the proect form project id is generated automatically.It is not be shown in the form. I have done uptil here properly. But when we save this form In the table 'proj' field 'proj_custid' should be filled with the 'cid' from the cust table. That is 'proj_custid' should be same as 'cid'
My Query runs like this
Dim sql As String = ("select cid from cust where custname= & cbxcustname.Text ")*'cbxcustname is name of combobox
sql=dr("cid")
custid=sql*declared custid as integer at the windows form generated designer code*
Inserted this custid in the insert query . But it is not working Can anyone help me out in this? This may be a very silly thing for all of you. But I am novice programmer. Please guide me