|
oh sorry..
my code is like
<ItemTemplate>
<asp:buttonlink id="mylist" text='<%#container.dataitem("packageName") %>' ></asp:buttonlink>
</ItemTemplate>
</asp:DataList>
but i think asp:buttonlink is not allow inside itemtemplate
|
|
|
|
|
I have some doubted.
why are u using SELECT count(*)...? Does count mean counting?.
and
userID = @userName AND packageID = @packageID
userID is int and can it compare with @username which it is varchar?
in my database table. I have create something like
t_package: packageID (pk), packageName
t_user: userID (pk), userName, password, gender....
t_userPackage: userID, packageID
|
|
|
|
|
LovelyHelp wrote: Does count mean counting?
Yes, I want the number of links between the tables for a secific package and user combination.
LovelyHelp wrote: userID is int and can it compare with @username which it is varchar?
Right - We are finally beginning to get somewhere with what the data model is.
Assumptions:
The application knows about user names and package names and nothing about IDs.
SELECT COUNT(*)
FROM t_userPackage AS up
INNER JOIN t_user AS u ON up.userID = u.userID
INNER JOIN t_package AS p ON up.packageID = p.packageID
WHERE u.userName = @userName
AND p.packageName = @packageName
From the .NET application, add parameters for @userName and @packageName with information in the application.
The result from the query is 0 (there is NO association between the user and package - assumming this means they have not paid for it) or 1 (there IS an associtation between the user and package - assuming this means they have paid for it)
If an association can exist between a user and package with the user NOT paying for the package then you need to explain that so the SQL can be modified to get that result.
Does this help?
"On two occasions, I have been asked [by members of Parliament], 'Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?' I am not able to rightly apprehend the kind of confusion of ideas that could provoke such a question."
--Charles Babbage (1791-1871)
My: Website | Blog
|
|
|
|
|
OH many to many is such a complicated relationship for me.
maybe should we start with the UI first. To display my item, should I use datalist or datagrid?
I need to show something like:
Tutorial's name
Tutorial description but is optional
2 button or maybe link. Where 1st link will be proceed to tutorial if user already pay for it and another link will be purchasing link where it purchase the tutorial.
so there is different tutorial.
so when example like i have paid for tutorial1 and not paid for tutorial2 then when i click on link 'proceed' for tutorial1 then I will automatically go to tutorial1's pages if i click on tutorial2's 'proceed' button then it will redirect to purchasing pages.
|
|
|
|
|
Hello!
This sample procedure extracts email addresses and adds to database. However, it is successfully adding the first address and creating empty records for the others. I decided to test the procedure with vb.net and took out adding the database section. It worked perfectly. So I would like to know what is causing not to add other emails except the first one. if you think xadd="" causing. The answer is no.
Thank You
Sub AddEmails()
Dim GetEmails
Dim SrchKey
Dim xPos
Dim x1, x2
Dim xAddr
GetEmails = Request.Form("emails")
xPos = 1
x1=Instr(xpos,GetEmails,VbCrLf)
DO WHILE xpos <= len(Getemails)
x1=Instr(xPos,GetEmails,vbCrLf)
x2=Instr(xPos+1 ,GetEmails,vbCrLf)
If x1 = 0 or x2 = 0 Then Exit Do
If xPos = 1 Then
xAddr = Mid(GetEmails,1,x1-1)
Elseif xpos > 1 Then
xAddr = Mid(GetEmails, x1, x2 - x1)
End If
If len(xAddr) > 4 Then
'check here if email address is not exist in the database
SrchKey = "SELECT * FROM emails WHERE email="& "'" & xAddr & "';"
Call InitializeConnection()
Call Establish_Recording(SrchKey)
If ObjectRecord.RecordCount <= 0 Then
ObjectRecord.Close
ObjectConnection.Close
Set ObjectRecord = Nothing
Call InitializeConnection()
Call InitializeRecordSet("Emails")
'PROBLEM IS CAUSED BY THE FOLLOWING STATEMENTS
'IT IS ADDING THE FIRST ADDRESS BUT NOT THE OTHERS
ObjectRecord.AddNew
ObjectRecord("email") = xAddr
ObjectRecord("Accept") = True
ObjectRecord.update
ObjectRecord.Close
ObjectConnection.Close
Set ObjectRecord = Nothing
Else
ObjectConnection.Close
End If
xAddr = ""
xpos = x2
End If
LOOP
Response.Write ("Email have been added!")
Response.End
End Sub
|
|
|
|
|
hello every body, I usually work with sql server so if anybody may help with MS Access I'd be thankful.
here 's my C# potion of code:
string selectId = "select categoryId from Category where categoryName = @catName";
myCommand = new OdbcCommand(selectId,myConn);
myCommand.Parameters.Add("@catName",categoryName.ToString());
myCommand.prepare();
myReader = myCommand.ExecuteReader();
at this level an exeption is thrown at the level of the odbc driver it says not enough parameters or something. 1 parameter missing. In my string i'm having only one parameter and it's @catName.
in the definition of the Add()function it says that the second parameter is the value of the named parameter. The function that contains this code receives the value of categoryName however it's not set! can anybody help pls
|
|
|
|
|
achrafus wrote: the odbc driver it says not enough parameters or something.
That's a bit vague - What is the EXACT error message? (From other things you've said I think I know what the problem is, but this kind of vague reference to an error message really is not useful and can irritate many people. There are often two similar error messages where the actual root cause is substantially different)
achrafus wrote: In my string i'm having only one parameter and it's @catName
Access does not use named parameters, use ? (the question-mark) and add the parameters in the order they appear in the query.
"On two occasions, I have been asked [by members of Parliament], 'Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?' I am not able to rightly apprehend the kind of confusion of ideas that could provoke such a question."
--Charles Babbage (1791-1871)
My: Website | Blog
|
|
|
|
|
Hi,
I'm writing a Windows application that's a front end interface for an Access database. I'm using VB.NET and I'm getting a very strange error when I try to edit a record in one of my tables. The error says:
"5 - Cannot set 'Discrepancy'"
Discrepancy is the column name.
The strange thing is that the line of code that's raising the error is within a Try, Catch, End Try block but the error is raised without the code execution passing through the Catch part of the block! And even stranger than that, the new value that I'm setting to the 'Discrepancy' field is being set, even though the error message says that it can't set it!!
I've checked, double-checked, and triple-checked all of the usual suspects (spelling, table mapping, schema, oleadapter configuration, etc) and everything seems fine. I can't for the life of me see what is wrong.
Can anyone help please?
I've included my code below. The line that's generating the error is the one with the EndEdit() method. I've also tried checking for errors on the line immediately before the EndEdit() method and there were none.
Try
Dim Record As DataRow = Me.dtsRent.Tables(0).Rows(Me.cmbWeek.SelectedIndex)
Dim Balanced as String
If CInt(Me.txtRentDisc.Text) = 0 Then Balanced = "Yes" Else Balanced = "No"
Record.BeginEdit()
Record.Item("Modified By") = Profile("Officer").ToString
Record.Item("Date Modified") = DateTime.Now.ToString
Record.Item("Reconciled") = Balanced
Record.Item("Total Payments") = CDec(Me.txtRentPayments.Text)
Record.Item("HBP19 Controls") = CDec(Me.txtRentHB19.Text)
Record.Item("Discrepancy") = CDec(Me.txtRentDisc.Text)
Record.EndEdit()
Me.adpRent.Update(Me.dtsRent)
Catch ex As Exception
MsgBox(Err.Number & " - " & Err.Description)
End Try
Thanks in advance.
QC
|
|
|
|
|
Try surrounding the field name with square brackets - "[Discrepancy]". Access has some weird keywords...
We need to graduate from the ridiculous notion that greed is some kind of elixir for capitalism - it's the downfall of capitalism. Self-interest, maybe, but self-interest run amok does not serve anyone. The core value of conscious capitalism is enlightened self-interest.
Patricia Aburdene
Bulls make money, bears make money, pigs get slaughtered.
Jim Cramer
|
|
|
|
|
Thanks Rob,
However, the field/column name is a string data type in VB. Including the square brackets in the string would make them part of the field/column name, rendering it unrecognisable (if that's a real word). Square brackets can only be used in an SQL command.
QC
-- modified at 11:59 Friday 28th April, 2006
|
|
|
|
|
hi all,
I need to FTP a File from another Computer.But the problem is we have to do it using SQL Server 2000.
Can anyone tell me that How can I do it using Sql Server 2000 and SQL?
thanks in advance.
|
|
|
|
|
Please see my problem below:
Table structure:
tmpItemPrice(ItemPriceID bigint not null , Thickness varchar(255))
Row1
ItemPriceID: 1
Thickness: xyz
Select ItemPriceID
From tmpItemPrice
Where IsNumeric(Thickness) = 1 and Cast(Thickness as float) <= 0
When above query runs it give my type conversion error which is logical as Thickness is not numeric. But when we use this query in IN clause as shown below it works fine.
select *
from tmpItemPrice
Where ItemPriceID in ( Select ItemPriceID
From tmpItemPrice
Where IsNumeric(Thickness) = 1 and Cast(Thickness as float) <= 0 )
So my question are:
- what is the reason behind it?
- Is it right to use it in this way?
Thanks
|
|
|
|
|
does anyone know how to search with case insensitive in access 2000 ?
|
|
|
|
|
Do you mean how to search case sensitive?
I believe MS Access is case insensitive by default.
What kind of search exactly are you trying to do?
----------
There go my people. I must find out where they are going so I can lead them.
- Alexander Ledru-Rollin
|
|
|
|
|
how much does Enterprise library affect on performance of the application????
Has anyone used it ?
|
|
|
|
|
Hi,
will the usage of UNION query affect the program throug put efficiency?how to over come that?
Thanks,
DiligenZ
|
|
|
|
|
DiligenZ wrote: will the usage of UNION query affect the program throug put efficiency?how to over come that?
The use of the UNION is to join the result sets of two or more queries into one query. When it is used there generally is no other option so efficiency cannot be a consideration unless you consider it more efficient not to run the query in the first place.
The alternative to using a UNION to join two result sets together is to create a temp table and INSERT the result sets into that then SELECT out of the temp table - I would suggest that route is vastly more complicated and time consuming that a UNION . You should be using temp tables if you want access to the result of a complex query a number of times in near future queries. This saves you from repeated running the same query.
If you are using a UNION incorrectly, for exampe
SELECT * FROM MyTable WHERE someColumn = 1
UNION
SELECT * FROM MyTable WHERE someColumn = 5 then it will probably have an impact - you should, in that case, construct a single query with a WHERE clause as
WHERE someColumn IN (1, 5)
"On two occasions, I have been asked [by members of Parliament], 'Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?' I am not able to rightly apprehend the kind of confusion of ideas that could provoke such a question."
--Charles Babbage (1791-1871)
My: Website | Blog
-- modified at 2:38 Friday 28th April, 2006
|
|
|
|
|
Hello, Here is the problem I have, is there anyone know how to slove it?
I have a Window XP SP2 machine with Microsoft SQL 2005, All my database are in this machine. I have an application is installing in another Window XP SP2 machine and in the same network. I cannot get access to the database from the second machine using my application. When I run the application, it says [DBNETLIB][ConnectionOpen(connect()).] SQL Server does not exit or access denied.
I know there is a firewall issue in the window xp sp2, I have already open the port 1433 in the server machine, but it still cannot connect.
I very apperiate your help.
Lisa
|
|
|
|
|
If I remember correctly, SQL Server 2005 is locked down and can only communicate with processes on the local machine. You have to turn on TCP/IP communications. I don't have SQL Server 2005 in front of me right now, and I don't remember the exact steps.
"On two occasions, I have been asked [by members of Parliament], 'Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?' I am not able to rightly apprehend the kind of confusion of ideas that could provoke such a question."
--Charles Babbage (1791-1871)
My: Website | Blog
|
|
|
|
|
will you please link some how to slove this kind problem articles for me? Thanks.
Lisa
|
|
|
|
|
Colin is absolutely correct (as always<smile>), 2005 is locked down by default.
For a solution to your problem point your browser here for a solution.[^]
Pictures of the menu available at the drive-thru
|
|
|
|
|
Ok, this may sound a little elementary but I have no clue what a "schema" is. I know quite a bit about Sql Server but it's not my area of expertise. My boss just emailed me saying he needs me to create a schema of one of our databases.
What exactly is a schema and how do I go about creating one in enterprise manager?
Thanks in advance.
-Goalie35
|
|
|
|
|
SQL Server Books Online says a schema "can be thought of as a conceptual object containing definitions of tables, views, and permissions."
But your boss probably just wants you to make a database diagram that has all the tables, relationships, keys, etc. in your database. The Diagrams node is right above the Tables node in the Enterprise manager. There isn't much to it.
----------
There go my people. I must find out where they are going so I can lead them.
- Alexander Ledru-Rollin
|
|
|
|
|
schema is a logical representation of Business logic from a database.
example: You have a large ERP system and have 4 schemas One each for Accounts, Stock Control, Purchasing and Sales.
Consider it a logical database within a physical database.
Look where you want to go not where you don't want to crash.
Bikers Bible
|
|
|
|
|
I have seen this syntax in several news group posts:
Dim AccessCommand As New System.Data.OleDb.OleDbCommand("INSERT INTO Orders SELECT * FROM [Orders] IN '' [ODBC;Driver={SQL Server};Server=(local);Database=Northwind;Trusted_Connection=yes];", AccessConn)
but of course it does not work and of course I cannot find any reference to anything like it at Microsoft. Does anybody know where to find the documentation to this kind of syntax?
Tom
|
|
|
|