|
Thanks for the tip, I'll have to makesure I am more observant next time
|
|
|
|
|
i have two tables .They are related by primary key,foreign key constrain.If i want to delete few rows in primary table without deleting corresponding rows in foreign key table . How will i do it.
|
|
|
|
|
hey whenever u delete a row it is copied somewhere exactly i dont know but we can retrive it back do some R and D u can do it easily
its me sid
|
|
|
|
|
How does this relate to the question being asked? The question was about the primary/foreign key contraint that exists between the 2 tables, not about retrieving the deleted rows from the primary key table.
Paul Marfleet
|
|
|
|
|
Try and give your posts more meaningful titles. 'Delete' is too vague. Read the forum guidelines.
Why would you want to do this if you have defined constraints between the 2 tables? One of the reasons for defining such a constraint is to prevent orphaned records remaining in the foreign key table when a primary key record is deleted. If you don't want such a constraint to exist, remove it.
Paul Marfleet
|
|
|
|
|
ritu4321 wrote: If i want to delete few rows in primary table without deleting corresponding rows in foreign key table . How will i do it.
Don't define any constraints between the two tables
|
|
|
|
|
i want to keep the constrain as it is but want to delete the row how will i do it.
|
|
|
|
|
ritu4321 wrote: i want to keep the constrain as it is but want to delete the row how will i do it.
Then what will be use of the constraint ? Why you need to do this ? Once the delete cascade is given, it will remove the foreign key values too.
|
|
|
|
|
|
Do you understand the purpose of such a constraint? It is there to enforce referential integrity between 2 tables, so values in the foreign key field in the related table must exist in the primary key field in the main table. If you don't want to enforce referential integrity, delete the constraint. It doesn't serve any purpose otherwise.
Paul Marfleet
|
|
|
|
|
Once values should the child table's contain i.e. when the parent key value is removed then what value should be there in child key.
can you give more clarity with some examples
Regards
KP
|
|
|
|
|
hi i know that storing a image in a database is not a correct option but requirement is like that so if anyone is having any idea please let me know
i know few thing abt access that the datatype must be ole object and i know how to get back the image so storing is only the problem
i hope i am clear
thank u
sindhu tiwari
its me sid
|
|
|
|
|
sindhutiwari wrote: so storing is only the problem
What about googling[^] it ?
|
|
|
|
|
thank's for the help but i need a code in c# not the complete one even the glimpse of the code will be sufficient i am confused weather to convert the photo in a byte stream or directly saving the object if u have any idea let me know
sindhu tiwari
its me sid
|
|
|
|
|
sindhutiwari wrote: am confused weather to convert the photo in a byte stream or directly saving the object
You need a byte stream. But I think storing images in access database may remove the meta data for the image.
|
|
|
|
|
Please don't cross post.
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
HI : The Given Code is to store the specifications of the controls which are added to a form dynamically ,the database used is access ,here global is a class , lsave & i are variables
there is no syntax error at complile time but runtime a error is coming i.e Syntax error in INSERT INTO statement . The database is absolutely fine with correct syntax...
clue's please........................................
OleDbConnection connection = new OleDbConnection();
connection.ConnectionString = WindowsApplication1.Properties.Settings.Default.printsoftwareConnectionString;
connection.Open();
//loop for saving the positions of the labels
OleDbDataAdapter oda = new OleDbDataAdapter("select * from controlspecifications",connection);
OleDbCommandBuilder cmb1 = new OleDbCommandBuilder(oda);
DataSet ds1 = new DataSet("controlspecifications");
oda.Fill(ds1, "controlspecifications");
DataRow dr = ds1.Tables["controlspecifications"].NewRow();
for (lsave = 0; lsave <= i; lsave++)
{
dr[0] = global.projectname + "adsfsd";
dr[1] = lab[lsave].Name;
dr[2] = Convert.ToInt32(lab[lsave].Left);
dr[3] = Convert.ToInt32(lab[lsave].Top);
dr[4] = Convert.ToInt32(lab[lsave].Width);
dr[5] = Convert.ToInt32(lab[lsave].Height);
dr[6] = lab[lsave].Text;
dr[7] = lab[lsave].Font.FontFamily;
dr[8] = Convert.ToInt32(lab[lsave].Font.Size);
dr[9] = lab[lsave].ForeColor.ToString();
dr[10] = lab[lsave].BackColor.ToString();
if (lab[lsave].Font.Bold == true)
{
dr[11] = "bold";
}
else if (lab[lsave].Font.Italic == true)
{
dr[11] = "italic";
}
else if (lab[lsave].Font.Underline == true)
{
dr[11] = "underline";
}
else
{
dr[11] = "strikeout";
}
dr[12] = "dasfsad";
ds1.Tables["controlspecifications"].Rows.Add(dr);
oda.Update(ds1, "controlspecifications");
oda.Fill(ds1, "controlspecifications");
sindhu tiwari
its me sid
|
|
|
|
|
You haven't shown your insert command. What is it?
|
|
|
|
|
i have done this thing before with sql server as a backend database unfortunately it doesnt seems to be working with the ms access if u have any code for inserting data into access database send me i will be thankful to u
even hints will be appreciated
its me sid
|
|
|
|
|
sindhutiwari wrote: i have done this thing before with sql server as a backend database unfortunately it doesnt seems to be working with the ms access
Your code has no insert statement in it. The code you have for SQL Server must have had some sort of insert statement in there somewhere.
Personally, I wouldn't use data adapters - they are more hassle than they are worth I've found. I'd generally write the insert statement and stick it on a regular command object.
|
|
|
|
|
anyway thanks my problem is solved and i have used the insert command now another problem came i need to store a image in the access database i am having an idea that the datatype in the access must be ole object i know how to get the image back from db but inserting is a problem so i u have any idea please do send it to me
thank you
regards
sindhu tiwari
its me sid
|
|
|
|
|
I work in VB.Net, so maybe this is a language difference, but why aren't you filling the datarow by using column names instead of an index? I would guess that the problem is that you are filling a column with an incorrect datatype or something like that. If you used column names instead of indexes, you could insure this would not happen. For example:
dr("SyleColumn") = "bold";
instead of
dr[11] = "bold";
But again, this may not be the exact syntax to do it in C#.
HOpe this helps.
|
|
|
|
|
Hi frndz,
In my machine, I have a MSSQL server named "Local" with one database "TEST1" and in server machine there is also one MSSQL server named "Sever" with one database named "TEST" with table "Tbl"
My doubt is,is it possible to excute
"select * from TEST.Tbl" query
from query analyser of "local"'.
Thanks in advance
All I ever wanted is what others have.... CrazySanker
|
|
|
|
|
If you set up a linked server, you should be able to query databases on this server using the syntax server.database.owner.table
Paul Marfleet
|
|
|
|
|
Thank u for your reply.
I setup the linked server command like
<br />
EXEC sp_addlinkedserver <br />
<br />
'server name',<br />
<br />
N'SQL Server'<br />
<br />
select * from [server name].[TEST].[dbo].[Tbl]<br />
but it shows error like
<br />
Server: Msg 18452, Level 14, State 1, Line 7<br />
Login failed for user '(null)'. Reason: Not associated with a trusted SQL Server connection.<br />
All I ever wanted is what others have.... CrazySanker
|
|
|
|