I have written a program using vb 2005 express that will create menu items after the user presses a particular button. So if the user picks a mountain dew then inside the reciept window(list box) the user will see 1 MT DEW $1.00 also as the user selects more items the price is calculated and displayed also.
This part of the program works fine. After using the program for a while I realized that I will need to update prices and be able to add and subtract items from the menu that customers order from. The way I accompolish this now is to go back into my code and rewrite alot of code. From reading the forums I think that a database would be a good solution because what I have gathered so far is that by seperating the data into tables i.e price_table it would be easy to update anything in that table and not have to change the code anywhere else.
I have created a database that contains a table for menu items and each item has a menu_item ID,menu_Name and I also have a Price table and each price now has it's own price_ID
I would like to have code under the button click event like so:
createMenuItem(By Val Food_ID as Database object, By Val Price_ID As Database object)
display(Quantity,Food_Name,Food_Cost)
Food_Cost = Quantity * Price_ID
I know that this code does not work but If someone reading this has any ideas which part of database programming this falls under I could use a nudge in the right direction.
In a nutshell I would like to create menu items using the id's from the database
the data in the database would remain static and would only be used to supply arguements for my procedures and function that I use now.
I have written this Program For Updating the profile Information .At the Page_Load Event I read the profile information from the database and write it in the respective Textboxes .At the Button_Click event I have written a program to Update the data from the respective Textboxes.The program executes but doesnot updates .public partial class CreateProfile : System.Web.UI.Page{ SqlConnection con; SqlCommand com; string un = HttpContext.Current.User.Identity.Name; protected void Page_Load(object sender, EventArgs e) { con = new SqlConnection("Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\Profiledata.mdf;Integrated Security=True;User Instance=True"); com = new SqlCommand("select * from profiletable where username='" + un + "' ", con); DataSet ds = new DataSet(); SqlDataAdapter da = new SqlDataAdapter(com); SqlCommandBuilder cb = new SqlCommandBuilder(da); DataTable dt = new DataTable(); da.Fill(ds); dt = ds.Tables[0]; Textname.Text = dt.Rows[0][1].ToString(); com.Cancel(); } protected void Button2_Click(object sender, EventArgs e) { con = new SqlConnection("Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\Profiledata.mdf;Integrated Security=True;User Instance=True"); con.Open(); com = new SqlCommand("update profiletable set name='" + Textname.Text + "' where username='" + un + "' ", con); com.ExecuteNonQuery(); com.Cancel(); con.Close(); }} Plz help me with this program........................
I have an SQL statement that, when run through SQL Server management studio works fine. However, when I run it on my ASP page, it doesn’t update the data! I have tried both as a stored procedure and as a simple commandText update statement. All I do is simly update the value of a column based on another column – nothing particularly complex: update customer set dateChanged = System.DateTime.Now.ToString("dd-MMM-yyyy"), CURRSTAT = 'Active',custType = case WHEN cust_Changing_To IS NOT NULL THEN cust_Changing_To ELSE custType END,cust_Changing_To = NULLFROM customers_v WHERE CURRSTAT = 'Changing'
As you can see, nothing that complex. The line that is causing the problem is the case: custType = case WHEN cust_Changing_To IS NOT NULL THEN cust_Changing_To ELSE custType END all it does is if another nullable integer column is not null, sets it to the value of that column, else it retains its existing value. Like I say, this works in Management studio, but I cannot get it to execute programatticaly from an asp page. No exceptions are being thrown, it just doesn’t update the data. Any ideas? Thanks
what the program will do if we caught that exception .. i need some suggestions ... i got this exception(String or binary data would be truncated. The statement has been terminated.).. will it affect the functionality of the program...
I am currently writing a program that will use a SQL database. I am use to writing programs that are used to connect over some type of a network, but for this project I need to be able to load the Database and it's tables to the system locally. If anyone has a suggestion it will be greatly appreciated, or any sites for documentation on it. Thank you.
I have been writing this piece of software for quite a while. And as it got bigger and bigger (more forms, more datasets) I started experiencing the following problem.
Well, I use an MDF file as a database container that gets copied to the destination directory after each build.
Well here is what happens: I launch my application, work with it, search the database and so on and so on. Then I exit the application. I launch it again and I get en exception saying that file counld not be located on the disk. I close the app, and run it again. I get the same thing. Somtimes after a couple of tries I get an error saying that my user does not have rights to access the default database. (I have windows authentication on SQL server)
Now here is the trick: I open SQL Server Management Studio Express detatch (Delete) the database from the default server (the only one in the system ".SQLEXPRESS") and the application runs again.
What am I doing wrong? How can I programatically detatch the database from the server (Maybe some sql command)? Do I need it though?
This is the connection string that I use for connection:
Code Snippet Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\MyAppDB.mdf;Integrated Security=True;Connect Timeout=10;User Instance=False
But the confusing part of it is that it happend on my work computer and not on my home computer. I have the same User/Password/Workgroup/VS version/MS SQL versoion/Windows version on both machines.
hi. When i click on the button, it will go to another page called fileB.aspx, it will query database based on textbox parameter from fileA.aspx and display gridview on fileB.aspx It is based on sqldatasource. abit noob on programming visual basic.Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click 'Code go here.End Sub
I am reading a guide telling how to create a private server and it says I need to restore the database. So I go to File->Open->File->My Computer->Local Disk->Program Files->Microsoft SQL Server->MSSQL.1->MSSQL->Data->GunzDB. Then the following message comes up: "The file cannot be opened because it is being used by another process. Please close all applications that might access this file and try again."
The question is, how do I get past this? I need the answer as soon as possible, I am a newb with this program so I don't entirely know what I am doing. I have tried searching for the answer, but I cannot find anything.
the idea is to put together a folder that is in some place in the computer, like "c:excel_fles" and the database full backup in a single .bak file, the database can be recovered with sql server management studio(but no the folder), the restoration of the program can be done with a program, I think it can be done with msdb, but I'm a little lost in the road.
We want to deny access to sql server 2005 database by the sql management studio or any other sql editor while our developed application can access the database even malicious user gets the login name and password by disassembling our code
hi need help how to send an email from database mail on row update from stored PROCEDURE multi update but i need to send a personal email evry employee get an email on row update like send one after one email
i use FUNCTION i get on this forum to use split from multi update
how to loop for evry update send an single eamil to evry employee ID send one email
Hello,I am trying to update records in my database from excel data using vbaeditor within excel.In order to launch a query, I use SQL langage in ADO as follwing:------------------------------------------------------------Dim adoConn As ADODB.ConnectionDim adoRs As ADODB.RecordsetDim sConn As StringDim sSql As StringDim sOutput As StringsConn = "DSN=MS Access Database;" & _"DBQ=MyDatabasePath;" & _"DefaultDir=MyPathDirectory;" & _"DriverId=25;FIL=MS Access;MaxBufferSize=2048;PageTimeout=5;" &_"PWD=xxxxxx;UID=admin;"ID, A, B C.. are my table fieldssSql = "SELECT ID, `A`, B, `C being a date`, D, E, `F`, `H`, I, J,`K`, L" & _" FROM MyTblName" & _" WHERE (`A`='MyA')" & _" AND (`C`>{ts '" & Format(Date, "yyyy-mm-dd hh:mm:ss") & "'})"& _" ORDER BY `C` DESC"Set adoConn = New ADODB.ConnectionadoConn.Open sConnSet adoRs = New ADODB.RecordsetadoRs.Open Source:=sSql, _ActiveConnection:=adoConnadoRs.MoveFirstSheets("Sheet1").Range("a2").CopyFromRecordset adoRsSet adoRs = NothingSet adoConn = Nothing---------------------------------------------------------------Does Anyone know How I can use the UPDATE, DELETE INSERT SQL statementsin this environement? Copying SQL statements from access does not workas I would have to reference Access Object in my project which I do notwant if I can avoid. Ideally I would like to use only ADO system andSQL approach.Thank you very muchNono
I want to retrieve the last update time of database. Whenever any update or delete or insert happend to my database i want to store and retrieve that time.
I know one way is that i have to make a table that will store the datetime field and system trigger / trigger that can update this field record whenever any update insert or deletion occur in database.
But i don't know exactly how to do the coding for this?
We have a SQL database that uses Active Directory with Windows Authentication. Can users that are members of the Active Directory group that has read/write access to the SQL database create ODBC connections to access the database directly and update the data? They dont have individual logins on the server. They are only members of the Active Directory group that has a login?
I had to to relocate the database log file and I issued an Alter database command but by mistake I put a space in the file name as below. The space is at the beginning file name. Now I am unable get the database loaded to SQL Server. The database has 2 replications configured, so deleting and re-attaching the database means the replication needs to be re-configured. Is there an alternative way to issue a command to update the database FILENAME ? Not sure if this can be edited in master database (sys files).
ALTER DATABASE [User_DB] MODIFY FILE (NAME = User_DB_log, FILENAME = 'I:SQLLogs User_DB_log.ldf') GO
I actually work in an organisation and we have to find a solution about the data consistancy in the database. our partners use to send details to the organisation and inserted directly in the database, so we want to create a new database as a buffer database to insert informations from the partners then make an update to the main database. is there a better solution instead of that?
I have an original database that I want to copy once to another database. Then I want to update the data weekly with the data of the original database. I don€™t change any tables or columns in that part of the database. Just some tables more in the €˜new€™ database (than the tables from the original database) with some references to the tables that have to be updated weekly. How can I do this? (if you know what I mean... it's a sort of a datawarehouse where different sources come together.. that part that represents the original database is just a part of the datawarehouse. That part is exactly the same structure as the original database.)
Hi guys, may I know is it possible to create an update trigger like this ? Assuming there are two database, database A and database B and both are having same tables called 'Payments' table. I would like to update the Payments records on database A automatically after Payments records on database B had been updated. I can't use replication because both tables might having different records and some records are the same. Hope can get any assistance here, thank you.
I am using two database server. Both are sql server.Â
My task is :I want to insert data from server 1 table to server 2 table and update same when modified the existing data from server 1. is it possible to do the integration in single package.
I know to do insert and update seperately by ssis but need to do same with single task.Â
I'm new to ASP.NET (I normally work with Windows Forms) and have installed the Club Website Starter Kit. I created an Administrators role and a user called "admin". When I run the project locally, everything works as it should - I can log in as admin and I can create new users. I then copied the site to localhost (C:Inetpubwwwroot), but when I run the site from localhost, I can't log in (as admin or any other user); instead I get a message that says, "Your login attempt was not successful. Please try again." Also, I can't create a new user. When I try, I get the following error: Server Error in '/' Application.
Failed to update database "C:INETPUBWWWROOTAPP_DATAASPNETDB.MDF" because the database is read-only. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.Data.SqlClient.SqlException: Failed to update database "C:INETPUBWWWROOTAPP_DATAASPNETDB.MDF" because the database is read-only.Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below. Stack Trace:
Version Information: Microsoft .NET Framework Version:2.0.50727.42; ASP.NET Version:2.0.50727.42 I figure there must be a simple(?) explanation and solution for this problem, and ideally, some sort of step-by-step procedure that new users to ASP.NET can follow to configure a site - such as one of the starter kits - to work correctly. I can honestly say that trying to get this working has been an extremely frustrating experience. If someone could help me out, I would really appreciate it. I've been working on this for two days and feeling I have hit the wall. Thanks in advance.
Hi there,I am getting a real problem with ASP.NET 2.0, all i am trying to do is run a recovert password (using the login controls) and i got the following error.Does anybody know how to fix this? I have tried the SSEUTIL answer here and it didn't work. http://forums.asp.net/909168/ShowPost.aspxI also ensured that Network Services user has READ/WRITE/EXECUTE premissions on the directory below and that each file isn't read only and also that it inherits ACL from the directory which it seems to do..Bit of strange one this, it isn't created (and i am not using) a beta version of VS 2005 Pro... but a full retail version.The PC is the local PC with IIS 5.1 and VS installed... it is the one i am using for developing.. I don't need to copy my files to the IIS directory below as that is where i have created it and open it in VS 2005 from there..I did read that if you use IIS 5.1 then the user should be ASPNET ... but i don't seem to have that use but a Network Services user...Any help or guidance would be really appreciated... i have come to a stop stage and can't get any further..Thanksian Server Error in '/igdotcom' Application.
Failed to update database "C:INETPUBWWWROOTIGDOTCOMAPP_DATAASPNETDB.MDF" because the database is read-only. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.Data.SqlClient.SqlException: Failed to update database "C:INETPUBWWWROOTIGDOTCOMAPP_DATAASPNETDB.MDF" because the database is read-only.Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
hi i am currently testing my website on IIS7, and first error is that: Server Error in '/' Application.
Failed to update database "C:INETPUBWWWROOTAPP_DATAASPNETDB.MDF" because the database is read-only. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.Data.SqlClient.SqlException: Failed to update database "C:INETPUBWWWROOTAPP_DATAASPNETDB.MDF" because the database is read-only.Source Error:
Line 109: Line 110: conn.Open(); Line 111: SqlDataReader reader = command.ExecuteReader(); Line 112: reader.Close(); Line 113: command.Connection.Close(); i cheked on aspnet_Data folder to see if is read-only AND IT IS, but if i change it, the read-only property is setting up again. why? thanks in advance
I have made sure that the permissions on the DB are set (in Windows) so that all users can modify. The user that is logging in to the DB has status set to DBOWNER.
I have seen others experience the same problem - with ASP.net sites, not Windows Forms sites (thus most of their solutions dont apply to me)
Any ideas on what is wrong and how I can get this to work?
i have a program which should give the out like this XAPIALTMKT20010829105525.TXT
but its giving the output = 'X' which is just the first initial...how can i get this...
if i don't write the @filename=.... only then its giving the output..but i want to store it in the varable..how can i do that ================================ declare @v datetime , @filename varchar
It is very interesting to me that most people in this group can't do simpleSQL. Are you viewing MySQL as a simple file system?As long as you do that,you willnot understand SQL in any dialect. So from now on:When you have a question about SQL. post the table structures. Uh, "WithCreate".Post some sample data in the form of INSERTS.Regards,Rich--The journey is the reward.
I am trying to send an email from a cmd prompt from SQL Server 2005 server using mailsend program. I am getting the message "Could not send mail". I am really stumped, don't know how to fix it. Any suggesstions?
I have installed SQL Server 2005 and created a job. I made the job failed to test the mailsend program. The notification step that uses the mailsend succeeded but I did not get an email. I am using mailsend program on SQL Server 2000 and it works fine. I am really stomped and don't know what to do to fix it?
tblHIT - this table will reveive record every minutes Date | Time | Main_ID | Hit ------------------------------------ 3/1/2006 | 100 | 200 | 8700 ... ... ... 4/14/2008 | 100 | 200 | 4500 4/14/2008 | 100 | 201 | 8700 4/14/2008 | 200 | 200 | 3500 4/14/2008 | 300 | 201 | 7700 ... ...
I've also 1 job in SQL Server Agent will execute STORED PROCEDURE and will filter 7 days record before from current date and insert it into tblHIT_7days. tblHIT_7days shown as follow tblHIT_7days Date | Time | Main_ID | Hit ------------------------------------ 3/7/2008 | 100 | 200 | 8700 ... ... ... 4/13/2008 | 100 | 200 | 4500 4/13/2008 | 100 | 201 | 8700 4/13/2008 | 200 | 200 | 3500 4/13/2008 | 300 | 201 | 7700
I've plan to create TRIGGER. This TRIGGER will insert the appropriate record from tblHIT into tblHIT_7days and also delete a appropriate record in tblHIT_7days. This INSERT and DELETE transaction depend on current date.