SEARCH YOUR SOLUTION HERE  

fetch data using sql statement...help!!!

i have 2 tables. Products and Quotation. 1st, i fetch prodNumber (value for prodName) and prodName (for display in combo box) into a combo box. then user is able to select any prodName listed in the combo and save it into Quotation after complete insert the description and price. the prob is, only prodNumber go to Quotation, the prodName is failed. how to solve that here is my code

Code: ' save data into Quotation Dim sqlCheck, rsCheck, sqlFetch, rsFetch, tmpProdName If Request.Form("Submit") = "Save" Then resID = Request.Form("resID") category = Request.Form("cmbProdNumber") description1 = Request.Form("description1") price = Request.Form("price") 'check existing prodNumber in the Quotation sqlCheck = "select * from Quotation where prodNumber = " & category & " And resID = " & resID Set rsCheck = Server.CreateObject("ADODB.Recordset") rsCheck.Open sqlCheck, dbcon 'try to fetch prodName from Products that match with category sqlFetch = "select prodName from Products where prodNumber = " & category Set rsFetch = Server.CreateObject("ADODB.Recordset") rsFetch.Open sqlFetch, dbcon If rsCheck.EOF = True And rsFetch.EOF = True Then tmpProdName = rsFetch("prodName") sql2 = "INSERT INTO Quotation (resID, prodNumber, prodName, description, price) " & _ "VALUES ("&resID&", "&category&", '"&tmpProdName&"', '"&description1&"', '"&price&"')" dbcon.Execute(sql2) Response.Redirect("quotation_admin.aspid="&resID) Else Session("error") = True End If End If ' below is the code that i used to put all all products in the combo box

Posted On: Friday 26th of October 2012 04:35:47 AM Total Views:  450
View Complete with Replies




Related Messages:

combo values to fetched dynamically from sql based on the value in other combo   (204 Views)
Hi I am a beginner, There are two Combo Box's on the form, one combo box holds the value Dealer and Sales Employee. The second one I want to be dynamically fetched from sql server, when the user chooses a value from the first combo box I want the second combo box to be populated with the names of dealars/employees fetched from sql server accordingly. Obviously a database is required and i've got the data setup in there. As I am beginner I don't know how to do this, please somebody help me out
Combo values to fetched dynamically from sql based on the value in other combo   (215 Views)
Hi I am a beginner, There are two Combo Box's on the form, one combo box holds the value Dealer and Sales Employee. The second one I want to be dynamically fetched from sql server, when the user chooses a value from the first combo box I want the second combo box to be populated with the names of dealars/employees fetched from sql server accordingly. Obviously a database is required and i've got the data setup in there. As I am beginner I don't know how to do this, please somebody help me out
fetch data from table and display as check boxes   (305 Views)
Can someone tell me how to retrieve data from table and display it as checkboxes.
How to fetch the value of dynamic controls in asp   (251 Views)
Hi all, I want to fetch the input box value which is dynamically added on asp page using javascript/jquery.... Code is: function addphone() { $("div#addnewtagP").before('  select oneHomeWorkOther'); } function addemail() { $("div#addnewtagE").before('  select oneHomeWorkOther'); } Add another Add another but in this code all the text box have same value, how can i differ one from another.... plese help
VBScript - Database - General - Add two variable values fetched from MSSQL to a new variable   (189 Views)
Please help me: i have fetched 2 data to 2 different variable. now i want to add these two variable value to a new variable. Help me ASAP
There are no rows in the current fetch buffer   (274 Views)
I am trying to update a SQL 2005 (express) table using an ADO recordset. I can't seem to nail down the exact problem here, and the error message is not overly helpful. It's the first time I've ever seen this error."Microsoft OLE DB Provider for SQL Server (0x80004005)There are no rows in the current fetch buffer."I'm receiving the error when it gets to the ".update" line. Strangely, the code executes fine one time, then the next, it fails and I get the error message.Any ideas Thx in advance for the help.
FTP and return code fetching   (254 Views)
I'm writing an ftp client with gtk+2.0 and C. I looked at the RFC and when i log on i get the return code 220 which prompts for a user login. I send the login info and then attempt to fetch return code 331 from the server which indicates that it's time for a password. I opened up ethereal and found that i do get a prompt for 331 but my program doesn't pick up the 331. I'm fetching the return code the same way i did for the 220 only i don't get 331 so i can tell the user. Any help is appreciated. Here's a snipper of the relevant code: I have defined the return codes previously in #define PASSWORD 331 etc. just for reference. You can ignore the str functions since i'm just making the send info, which i think is irrelevant to the problem. I end up getting junk in the second return code which is marked below. (Toggle Plain Text) void on_button8_clicked (GtkButton *button, gpointer user_data) { int sockfd; struct sockaddr_in their_addr; struct hostent *h; int retcode=0; char retmsg[13]; //the return code i get, which i atoi for retcode char gmsg[40]; // the thing i send int len=0; int numbytes=0; int retcodelen=3; int sendbytes=0; GtkTextBuffer *buffer=NULL; GtkTextIter iter; GtkWidget *textboxen=lookup_widget(GTK_WIDGET(button),"textview1"); buffer=gtk_text_view_get_buffer(GTK_TEXT_VIEW(textboxen)); GtkWidget *entry3=lookup_widget(GTK_WIDGET(button),"entry3"); char *fetchuser=gtk_entry_get_text(GTK_ENTRY(entry3)); GtkWidget *entry4=lookup_widget(GTK_WIDGET(button),"entry4"); char *fetchpass=gtk_entry_get_text(GTK_ENTRY(entry4)); GtkWidget *entry5=lookup_widget(GTK_WIDGET(button),"entry5"); char *fetchip=gtk_entry_get_text(GTK_ENTRY(entry5)); h=gethostbyname(fetchip); sockfd=socket(AF_INET, SOCK_STREAM,0); their_addr.sin_family=AF_INET; their_addr.sin_port=htons(PORT); their_addr.sin_addr.s_addr=inet_addr(inet_ntoa(*((struct in_addr *)h->h_addr))); memset(&(their_addr.sin_zero), '\0',8); if (connect(sockfd,(struct sockaddr *)&their_addr,sizeof(struct sockaddr))==-1){ gtk_text_buffer_get_iter_at_offset (buffer, &iter, 0); gtk_text_buffer_insert (buffer, &iter, "Connection error. Please enter hostname or ip address.\n", -1); } else{ numbytes=recv(sockfd,retmsg,retcodelen,0); retcode=atoi(retmsg); printf("%s, %d",retmsg,retcode); //debug line, it works if (retcode==LOGIN){ gtk_text_buffer_get_iter_at_offset (buffer, &iter, 0); gtk_text_buffer_insert (buffer, &iter, "\nConnected, Logging In...", -1); strcpy(gmsg,"USER "); strcat(gmsg,fetchuser); strcat(gmsg,"\r\n"); //printf("%s",gmsg); //debug line len=strlen(gmsg); sendbytes=send(sockfd,gmsg,len,0); // send user info, works numbytes=recv(sockfd,retmsg,retcodelen-1,0); retcode=atoi(retmsg); printf("\nafter recv:%s,%d\n",retmsg,retcode); //debug line, junk ret. if (retcode==PASSWORD){ strcpy(gmsg,"PASS "); strcat(gmsg,fetchpass); strcat(gmsg,"\r\n"); printf("%s",gmsg); //debug line len=strlen(gmsg); sendbytes=send(sockfd,gmsg,len,0); numbytes=recv(sockfd,gmsg,retcodelen,0); retcode=atoi(gmsg); if(retcode==LOGGED_IN){ gtk_text_buffer_get_iter_at_offset (buffer, &iter, 100); gtk_text_buffer_insert (buffer, &iter, "Authentification Successful.\n", -1); } } } } //end else } void on_button8_clicked (GtkButton *button, gpointer user_data) { int sockfd; struct sockaddr_in their_addr; struct hostent *h; int retcode=0; char retmsg[13]; //the return code i get, which i atoi for retcode char gmsg[40]; // the thing i send int len=0; int numbytes=0; int retcodelen=3; int sendbytes=0; GtkTextBuffer *buffer=NULL; GtkTextIter iter; GtkWidget *textboxen=lookup_widget(GTK_WIDGET(button),"textview1"); buffer=gtk_text_view_get_buffer(GTK_TEXT_VIEW(textboxen)); GtkWidget *entry3=lookup_widget(GTK_WIDGET(button),"entry3"); char *fetchuser=gtk_entry_get_text(GTK_ENTRY(entry3)); GtkWidget *entry4=lookup_widget(GTK_WIDGET(button),"entry4"); char *fetchpass=gtk_entry_get_text(GTK_ENTRY(entry4)); GtkWidget *entry5=lookup_widget(GTK_WIDGET(button),"entry5"); char *fetchip=gtk_entry_get_text(GTK_ENTRY(entry5)); h=gethostbyname(fetchip); sockfd=socket(AF_INET, SOCK_STREAM,0); their_addr.sin_family=AF_INET; their_addr.sin_port=htons(PORT); their_addr.sin_addr.s_addr=inet_addr(inet_ntoa(*((struct in_addr *)h->h_addr))); memset(&(their_addr.sin_zero), '\0',8); if (connect(sockfd,(struct sockaddr *)&their_addr,sizeof(struct sockaddr))==-1){ gtk_text_buffer_get_iter_at_offset (buffer, &iter, 0); gtk_text_buffer_insert (buffer, &iter, "Connection error. Please enter hostname or ip address.\n", -1); } else{ numbytes=recv(sockfd,retmsg,retcodelen,0); retcode=atoi(retmsg); printf("%s, %d",retmsg,retcode); //debug line, it works if (retcode==LOGIN){ gtk_text_buffer_get_iter_at_offset (buffer, &iter, 0); gtk_text_buffer_insert (buffer, &iter, "\nConnected, Logging In...", -1); strcpy(gmsg,"USER "); strcat(gmsg,fetchuser); strcat(gmsg,"\r\n"); //printf("%s",gmsg); //debug line len=strlen(gmsg); sendbytes=send(sockfd,gmsg,len,0); // send user info, works numbytes=recv(sockfd,retmsg,retcodelen-1,0); retcode=atoi(retmsg); printf("\nafter recv:%s,%d\n",retmsg,retcode); //debug line, junk ret. if (retcode==PASSWORD){ strcpy(gmsg,"PASS "); strcat(gmsg,fetchpass); strcat(gmsg,"\r\n"); printf("%s",gmsg); //debug line len=strlen(gmsg); sendbytes=send(sockfd,gmsg,len,0); numbytes=recv(sockfd,gmsg,retcodelen,0); retcode=atoi(gmsg); if(retcode==LOGGED_IN){ gtk_text_buffer_get_iter_at_offset (buffer, &iter, 100); gtk_text_buffer_insert (buffer, &iter, "Authentification Successful.\n", -1); } } } } //end else }
How to fetch large data from sql server in asp   (233 Views)
I want to count number of data available depending upon the conditions in the large database the database table rows are approximately 3 lakhs and there are multiple table to be searched and records need to be displayed in ASP pages. Kindly suggest the best scripting method as i am always getting error like "Script Time Out" Error in Active Server Pages (ASP) please suggest how to avoid or in sql server i can create some pre defined script and just call from asp pages
Can anyone get this fetch script to work?   (255 Views)
I found this script which (apparently) takes an image from a website and spits it out. But it doesn't work.. it says.. Server object error 'ASP 0177 : 800401f3' Server.CreateObject Failed /grab_image.asp, line 4 800401f3 Can anyone help I know very little about asp (script below) Code:
Problem in fetchimg data from SQL Srver 2000 via asp pages   (230 Views)
Hi , I am using SQL Server-2000, VB 6.0 and ASP. When i fetched data from VB 6.0 using XML string, passed into ASP pages, it shows data more than onc time. Please anyboy can help me to find out what is the problem Please reply as soon as possible.
fetch data from table and display as check boxes   (217 Views)
Can someone tell me how to retrieve data from table and display it as checkboxes.
cannot fetch latest ID number after insert new data...help me!!!   (304 Views)
this my scripts to fetch new data. If Session("success") = True Then sql2 = "select * from Reservation" Set rs = db1con.Execute(sql2) rs.MoveLast resID = rs("resID") rs.Close Set rs = Nothing End If the error i found. Microsoft JET Database Engine (0x80040E24) Rowset does not support fetching backward. /minarex/reservation.asp, line 51 i want to fetch and display the latest ID on the page after user has submit his data. the ID is generated by autonumber in the database.
Rowset does not support fetching backward.   (307 Views)
, I'm getting this error when trying to get the last record in a recordset using rs.MoveLast "Rowset does not support fetching backward." Any suggestions... Thanx
fetching "n" number of records from the database   (187 Views)
Originally posted by : r.balasubramanian (pillaiyar72@hotmail.com)I have about 1 lac records in my database and I want to fetch and display only 100 records at a time. When the user presses the NEXT button, next 100 records to be displayed. How to achieve this
fetching Object data from MS-Access   (247 Views)
Originally posted by : prashant (prashant_st@hotmail.com)hi I have a data in MS-Access, I can fetch all fields but except object type data (.BMP) file(i.e Images) so please help me and give entire code
fetch page from internet.   (188 Views)
I would like to have advises, or scripts, in order to go online (set proxy, port, access to internet), catch a page and save it locally
SP fetching Resultset and output parameter   (237 Views)
HI ,I am trying to fetech 2 int, 1 decimal and one resultset from a Stored Proc.here is my codlet========================================================set Command2 = Server.CreateObject("ADODB.Command")Command2.ActiveConnection = ACBDCommand2.CommandText = "report"Command2.Parameters.Append Command2.CreateParameter("@RETURN_VALUE", 3, 4,4)Command2.Parameters.Append Command2.CreateParameter("@monthcount", 3, 2,4)Command2.Parameters.Append Command2.CreateParameter("@monthavg", 14, 2,4)Command2.Parameters("@monthavg").Precision = 10Command2.Parameters.Append Command2.CreateParameter("@mincount", 3, 2,4)Command2.Parameters.Append Command2.CreateParameter("@month", 3, 1,4,Command2__month)Command2.Parameters.Append Command2.CreateParameter("@year", 3, 1,4,Command2__year)Command2.Parameters.Append Command2.CreateParameter("@dataid", 3, 1,4,Command2__dataid)Command2.CommandType = 4Command2.CommandTimeout = 0Command2.Prepared = truers = Command2.Execute^^^^^^^^^^^^^^^^^^^^^^===========================================================My problem is that when I get the resultset I do not get the values of the output parameters and if I remove the result set I get the values of the output variables.In My code, If I replace the last line "rs = Command2.Execute" with "Command2.Execute" I get the values of my output variables of my SP.Can U please point where I am going wrong TIA,Saurabh Shukla
Rowset does not support fetching backward.   (262 Views)
I'm having a problem when returning a recordset from a SQL server stored procedure. I have set the cursor and lock properties of the recordset but I get an error when I use .movelast etc
fetch data from table and display as check boxes   (209 Views)
Can someone tell me how to retrieve data from table and display it as checkboxes.
combo values to fetched dynamically from sql based on the value in other combo   (363 Views)
Hi I am a beginner, There are two Combo Box's on the form, one combo box holds the value Dealer and Sales Employee. The second one I want to be dynamically fetched from sql server, when the user chooses a value from the first combo box I want the second combo box to be populated with the names of dealars/employees fetched from sql server accordingly. Obviously a database is required and i've got the data setup in there. As I am beginner I don't know how to do this, please somebody help me out