|
This may not be the answer that you're expecting, but have you considered using Views to de-normalize the data? It sounds like you could create a "Family" view that is an INNER JOIN of tblFamilyNames and tblFamilyDetails. This could then be JOINed to tblMembers to give you a single unified view of the data.
Cheers!
Humble Programmer
,,,^..^,,,
|
|
|
|
|
Hi
I have a problem with INSERT,UPDATE table when working with ODBC in DotNet.
if you go to the following link and fill all the field and then click button see the error .i can not solve this.
http://www.bastanbar.com/ViewOrders.aspx
my connection string is in the following function
<br />
Public Shared Function GetConnection() As OdbcConnection<br />
Dim myConn As OdbcConnection<br />
Dim connStr, path As String<br />
Dim Request As System.Web.HttpRequest<br />
path = HttpContext.Current.Request.PhysicalApplicationPath()<br />
path = path + "data.mdb"<br />
connStr = "Driver={Microsoft Access Driver (*.mdb)};DBQ=" + path + ";ReadOnly=0;"<br />
myConn = New OdbcConnection(connStr)<br />
Return myConn<br />
End Function<br />
when i try to add one record to my table an error ocures
"ERROR [HY000] [Microsoft][ODBC Microsoft Access Driver] Operation must use an updateable query"
please help me to solve this problem
|
|
|
|
|
What does your INSERT query look like?
|
|
|
|
|
Hi martin
My INSERT query is in the following function
<br />
Public Function SaveTransInfo(ByVal idrequestman As Long, ByVal iddestinationInfo As Long, ByVal Y As String, ByVal M As String, ByVal D As String, ByVal Goods As String, ByVal idworker As Byte, ByVal Tonaj As Double, ByVal place As String, ByVal sdate As String) As Boolean<br />
Dim sqlStr As String<br />
Dim myCon As OdbcConnection = GetConnection()<br />
sqlStr = "INSERT INTO TransInfo(idrequestman,iddestinationInfo,Y,M,D,Goods,idworker,Tonaj,place,sdate) VALUES(" + idrequestman.ToString & "," & iddestinationInfo & ",'" & Y & "','" & M & "','" & D & "','" & Goods & "'," & idworker.ToString & "," & Tonaj.ToString & ",'" & place & "','" & sdate & "');"<br />
Try<br />
Dim myCommand As New OdbcCommand(sqlStr, myCon)<br />
myCon.Open()<br />
myCommand.ExecuteNonQuery()<br />
Catch ex As Exception<br />
myCon.Close()<br />
HttpContext.Current.Response.Write(ex.Message)<br />
Return False<br />
End Try<br />
myCon.Close()<br />
Return True<br />
End Function<br />
<br />
thanks for your attention<br />
<br />
|
|
|
|
|
You may need to adjust the permissions on the database file so that it can be written to by the ASP.Net user.
In Explorer navigate to the file and go to it's properties. Select security and add the built in ASPNET user and give it read/write permissions.
|
|
|
|
|
Hi
My files in my Host and i check read/write permissions .i have read/write permission to my db and the folder that my db reside in.(in fireFTP of mozilla i right click on my db and click property in the opend widow show me that i have read/write permissions to db)
i set
<br />
authentication mode="Windows" <br />
identity impersonate="true" <br />
BestRegards
|
|
|
|
|
Hmmm... I'm not sure what the cause is really. If you hard code the entire SQL statement (just for testing problems, does the error still occur?
I've also found this, which might be useful:
http://support.microsoft.com/kb/175168[^]
|
|
|
|
|
HI
Thanks for your help.i visit your link but in .NET i can't find any property or method like that.
again i try to solve this problem.
thank you
|
|
|
|
|
i try to attach a database to sqlserver 2005 in my computer
when click attach i see a exception with this message :
TITLE: Microsoft SQL Server Management Studio
------------------------------
Attach database failed for Server 'SHOKRIAN'. (Microsoft.SqlServer.Smo)
For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=9.00.1399.00&EvtSrc=Microsoft.SqlServer.Management.Smo.ExceptionTemplates.FailedOperationExceptionText&EvtID=Attach+database+Server&LinkId=20476
------------------------------
ADDITIONAL INFORMATION:
An exception occurred while executing a Transact-SQL statement or batch. (Microsoft.SqlServer.ConnectionInfo)
------------------------------
Could not find row in sysindexes for database ID 9, object ID 1, index ID 1. Run DBCC CHECKTABLE on sysindexes.
Could not open new database 'ProposalSystem'. CREATE DATABASE is aborted. (Microsoft SQL Server, Error: 602)
For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&EvtSrc=MSSQLServer&EvtID=602&LinkId=20476
------------------------------
BUTTONS:
OK
------------------------------
help to silv this problem plz
|
|
|
|
|
Do you have a typo? It looks like either the ProposalSystem database doesn't exist or it has some problems with it. Did you delete some system tables from this database?
Ben
|
|
|
|
|
I'm using SQL Server 2005 and when trying to create an Agent Job I get the following error:
Unable to cast object of type 'Microsoft.SqlServer.Management.Smo.SimpleObjectKey' to type 'Microsoft.SqlServer.Management.Smo.Agent.JobObjectKey'. (Microsoft.SqlServer.Smo)<br />
I've googled it but the only solution provided was to repair the SQL Native Client, which didn't solve my problem.
Any ideas what else should I try?
Cheers,
Mircea
"Pay people peanuts and you get monkeys" - David Ogilvy
|
|
|
|
|
Hi all,
Few days back an interviwer asked me an SQL question. I searched the answer in the net, but i cant able to find it. Plz any one help me. The question is"How and where will you store the records retrived from an table temporarily in the database", he asked me without creating an table, how to store the records retrived (using select query) from an table to temporavery table, actually there is no such an table, in other word that temporavery table is an virtual table.
Can any one suggest me the answer plz.
Thanks in advance
Know is Drop, Unknown is Ocean
|
|
|
|
|
|
You can create a temporary table by prefixing the name with # which which create a table for that user in the TempDb database on the SQL server, meaning that each user will have their own copy
You can also do global temporary tables as well if you need to.
Read more about this here[^]
|
|
|
|
|
|
Hi,
I'm trying to write a small application in VB6 to backup and restore databases. I have looked up the code in the SQL Server Books Online but it keeps on giving me an SQL error.
I have tried 2 different forms of code ... see below with the error.
1)
SQL
USE master
EXEC sp_addumpdevice 'disk', 'APDB', DISK ='C:\SQLBCKUTIL\DatabaseBackups\05Jul2007_101009_APDB.dat', 2
ERROR
Incorrect syntax near the keyword 'DISK'.
2)
SQL
BACKUP DATABASE APDB
TO DISK = 'C:\SQLBCKUTIL\DatabaseBackups\05Jul2007_101009_APDB.BAK'
WITH FORMAT,
NAME = 'Full Backup of APDB'
ERROR
Cannot open backup device 'C:\SQLBCKUTIL\DatabaseBackups\05Jul2007_101009_APCON.BAK'. Device error or device off-line. See the SQL Server error log for more details.
BACKUP DATABASE is terminating abnormally.
Anyone have any ideas?
Cheers for now,
Allan
PEBKAC
Problem Exists Between Keyboard And Chair
|
|
|
|
|
Have you found a solution to your problem?
"Any sort of work in VB6 is bound to provide several WTF moments." - Christian Graus
|
|
|
|
|
unfortunately not.
any suggestions????
Cheers for now,
Allan
PEBKAC
Problem Exists Between Keyboard And Chair
|
|
|
|
|
|
Hi,
can anyone tell me how to genrate sdf files in sql 7.0.
I had search this in google but i havent got proper answer.
So,can anyone help me in this.
Thanks.
GIRISH
|
|
|
|
|
Hi,
I have question on usage of composite primary keys. I know it is suggested not to use them for performance reasons (wide indexes). But when it comes to enforcing the integrity constraints, composite keys help me.
Scenario:
I have the following tables.
Projects and Employees.
These tables share a m:n relationship and there is an intermediary table called "ProjectAssignments" with the following structure.
ProjectID, EmployeeID, EmpRole, AssignedBy, AssignedOn. (Primary Key: ProjectID & EmployeeID)
Employees with reviewer role, review the tasks of their reviewees on the specified date. This is captured with the following structure.
ReviewID, ProjectID, EmployeeID_Reviewer, EmployeeID_Reviewee, ReviewDate, TaskDesc. (PrimaryKey: ReviewID)
I would like the design to enforce the constraint that reviewer and reviewee are on the same project. I have defined the foreign keys as follows.
FOREIGN KEY([PRJ_ID], [EMP_ID_Reviewee]) REFERENCES [dbo].[ProjectAssignments] ([AGN_PRJ_ID], [AGN_EMP_ID])
FOREIGN KEY([PRJ_ID], [EMP_ID_Reviewer]) REFERENCES [dbo].[ProjectAssignments] ([AGN_PRJ_ID], [AGN_EMP_ID])
Is this is a good design?
The other alternative I thought has the following design. But, this does not enforce the above mentioned constraint.
Table ProjectAssignments: AssignID, ProjectID, EmployeeID, EmpRole, AssignedBy, AssignedOn. (Primary Key: AssignID)
(Unique Constraint: ProjectID, EmployeeID)
Table ProjectReviews:
ReviewID, AssignID_Reviewer, AssignIDReviewee, ReviewDate, ReviewTask. (Primary Key: ReviewID)
Which one should I prefer and why? I
Thanks,
AGL
|
|
|
|
|
I prefer the second one. I assume that the reviewer is reviewing an employees actions on a particular project so I would revamp the ProjectReviews to look like this:
ReviewID (PK),
AssignID (FK - ProjectAssignment),
ReviewerEmployeeID (FK - Employee),
RevieweeEmployeeID (FK - Employee),
ReviewDate,
ReviewTask
The reason I would choose your second method is for maintenance reasons. I could look at the column structures and pretty much tell what links to what without having look too deeply into the FK constrants. This makes things much easier 2 years down the road.
I would enforce the relationship of the Reviewer/reviewee & AssignId in the ProjectReviews via a stored proceedure (or trigger). You could add deeper FK relationships to manage this for you but, the nature of the data does not seem to make it necessary. If a reviewer gets hit by a car and is removed from a project, is it necessary to remove all of his/her reviews? Only you can answer questions like that.
If you are expecting millions of records, then the second method will execute joins faster because of the smaller keys. If your database is small, the time saved will not be noticeable.
|
|
|
|
|
Thanks Mike. As you suggested, I chose the second option.
|
|
|
|
|
this is the msg that show when iam trying to apply this code
Dim f1, f2, f3, f4, f5, f6, f7, f8 As String<br />
<br />
f1 = "#" & DateTimePicker1.Value & "#,"<br />
<br />
f2 = "'" & ComboBox1.Text & "',"<br />
<br />
f3 = "'" & ComboBox2.Text & "',"<br />
<br />
f4 = "'" & TextBox1.Text & "',"<br />
<br />
f5 = "'" & TextBox2.Text & "',"<br />
<br />
f6 = "'" & TextBox3.Text & "',"<br />
<br />
f7 = "'" & TextBox4.Text & "',"<br />
<br />
f8 = "'" & Label10.Text & "'"<br />
<br />
s = "insert into sale"<br />
s = s & " (dte,op,nos,cost,coms,nii,npp)values "<br />
<br />
s = s & "(" & f1 & "," & f2 & "," & f3 & "," & f4 & "," & "," & f5 & "," & "," & f6 & "," & f7 & "')"<br />
<br />
cmd.CommandText = s<br />
cmd.ExecuteNonQuery()<br />
MsgBox("Saved succssefuly")<br />
<br />
any suggestion ?
plz help urgent
|
|
|
|
|
dte column looks datetime datatype
magedhv wrote: s = s & "(" & f1 & "," & f2 & "," & f3 & "," & f4 & "," & "," & f5 & "," & "," & f6 & "," & f7 & "')"
change the query to
s = s & "('" & f1 & "'," & f2 & "," & f3 & "," & f4 & "," & "," & f5 & "," & "," & f6 & "," & f7 & "')"
so that the date is incloded in single quotes
Regards
KP
|
|
|
|
|