R8VI
asked on
Compare database results on the fly visual c#, asp.net
Hi,
What I want to do is get all the results from the database of a particular row and compare them to a string if the string does not match any row then insert.
I know how to establish a connection and get the results
can someone provide some code examples
Please help
Thanks,
R8VI
What I want to do is get all the results from the database of a particular row and compare them to a string if the string does not match any row then insert.
I know how to establish a connection and get the results
can someone provide some code examples
Please help
Thanks,
R8VI
what error are you getting?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
The check you are trying to do is quite simple
i will give you the logic to do in the stored procedure
in the sp first check for if the record you are trying to insert exists or not
let the variable in the db is @Name
If Exists (Select 1 From TableName Where Name = @Name)
Begin
// update the existing record
End
Else
Begin
//Insert a new record
End
>> you said you are getting error on this line GetallRFromDatabase = rdrEvery["rerl"].ToString( );
but what is the type of GetallRFromDatabase
i will give you the logic to do in the stored procedure
in the sp first check for if the record you are trying to insert exists or not
let the variable in the db is @Name
If Exists (Select 1 From TableName Where Name = @Name)
Begin
// update the existing record
End
Else
Begin
//Insert a new record
End
>> you said you are getting error on this line GetallRFromDatabase = rdrEvery["rerl"].ToString(
but what is the type of GetallRFromDatabase
ASKER
I have this so far
ArrayList GetDat = new ArrayList();
SqlConnection oConnecttoNwsCategories = new SqlConnection(Configuratio
oConCategories.Open();
SqlCommand EverythinginPageUrls = new SqlCommand("sp", oConCategories);
EverythinginPageUrls.Comma
EverythinginPageUrls.Execu
SqlDataReader rdrEnPageUrls= EverythinginPageUrls.Execu
while (rdrEnPageUrls.Read())
{
GetallRFromDatabase = rdrEvery["rerl"].ToString(
}
but get an error on GetallRFromDatabase = rdrEvery["rerl"].ToString(
thanks,
R8VI