SQL Server stored procedure - C# PK - FK -
quite new sql server , discovered wonderful world of stored procedures - , gives me headache. came here help. scenario 1 : given table, wrote stored procedure , call in c# populate table. works expected. country sql table looks this stored procedure: create procedure [dbo].[insertrecord2] @countryname nvarchar(64), insert country(countryname) values (@countryname) return calling in c# private void button1_click(object sender, eventargs e) { readonly sqlconnection _connection = new sqlconnection(@"data source=rexgbasqlp042;initial catalog=isg_cid;integrated security=true"); _connection.open(); sqlcommand _command = _connection.createcommand(); _command.commandtype = commandtype.storedprocedure; _command.commandtext = "insertrecord2"; _command.parameters.add("@countryname", sqldbtype.nvarchar).value = countryname.text; _command.executenonquery(); _connection.close(); } scenario 2 : want ...