Insert Data From Office To Hosted Database
Apr 28, 2006
What is the best way to insert records into an SQL Server 2005 database that's being hosted with my website. The data will originate from customer sites as transactions. Do I connect to the hosted database using TCP/IP or do I create web pages that accept the data variables? This is all new to me!
I need this to happen unattended and 24/7/365
Thanks
Tim
View 1 Replies
ADVERTISEMENT
May 27, 2006
Hi!
Today we moved from 32bit to 64bit computing environment. 64bit Window server 2003 and SQL 2005 are now our playing ground. And 32 bit Office 2003 is also installed. Excel in Office program plays important roll in our mission.
One of our routine task is that
step 1. get Excel data files from other websites and
step 2. extract specific data from them and
step 3. converting them into some type of data that can be compatible with SQL
Our problem occured in step 3. To convert data, we realised taht 64 bit excel driver, which we believe is not yet available, is required.
My questions are:
1. Is 64 bit excel driver (of office 2003 or office 2007) available now?
2. Is there any way OR IS IT POSSIBLE to use 32 bit excel driver with 64bit SQL 2005?
If possible, please enlighten me.
I would appreciate it very much if anybody answer my questions.
Sincerely
View 8 Replies
View Related
Aug 1, 2007
Hi,
How do I insert data that I have collected in a local database onto a table on my online ie hosted database which is on a different server?
At the moment I am just uploading all the data to the hosted DB but this is wasting bandwith as only a small percentage of data is actually selected and used.
I thought that if i used a local DB and then update the table on my hosted DB this would be much more efficient, but I am not sure how to write the SQL code to do this!
Do I do some kind of
INSERT INTO sample_table
SELECT xxx
FROM origanal_table
Or is it more complicated than this?
Thanks
View 6 Replies
View Related
May 16, 2006
Hi All,
Do anybody know if it's possible to have an SQL 2005 server deal with and out of office reply from an email its send via the new Database Mail?
My application sends mail to users, giving them task instructions via Database Mail, however if they have thier out of office set true, I just get a reply msg in the profiles inbox. I would like the SQL server to know that they are out of office.
I can recogise the replys by the subject and I have control over the format of the replies, so its just case of getting the SQL server to read msg in the inbox.
Thanks
Gary T
View 3 Replies
View Related
Mar 7, 2008
I've tried everything. The CreateUserWizard works fine, but then, I didn't have to connect anything for that. I've tried both SQLServer and MySQL. Connection Strings are correct, everything is correct as far as I can see. I've followed every step many many times. I'm about to go back to the old style and use VB6, because this is just stupid. The error I get is "An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)" If anyone could help me out with this I'd really appreciate it.
View 6 Replies
View Related
Jun 28, 2012
I have a SQL Server 2005 database hosted by a provider that has about 500 databases on their site. I am running Access2007 on a Windows 7 Home Premium edition.
What I am trying to do is create a new Access2007 application and attach (i.e: Link) to the SQL Server tables. I am using SQL Authentication.
I have done this before where i attached via ODBC to Oracle, but it was on the corporate network - not on a hosted server. When i try to walk thru the Access process, it does not seem to let me give it the database name. I have the connection string i use in C# (for example: Data Source, Initial Catalog, UserID and Password), how to connect with Access2007.
View 4 Replies
View Related
Sep 22, 2007
Hello,
I am working on an ASP.NET apllication which will work with sensitve data that needs stored as encrypted. The ASP.NET application and SQL Server 2005 will be hosted outside of our company.
My questions are:
When I create a database master key, a certificate and a symetric key to encrypt and decrypt my data, will I be able to use these (master key, cert and symetric key) in other databases (say my local development SQL Server 2005 instance)?
Is a managed hosting a better solution to have total control over the the keys in the database?
Is there a white paper or guidance document for security in hosted databases?Thanks
-Al
View 3 Replies
View Related
Mar 18, 2006
Hello,
I would like to know whether is it possible to administer a database on a hosted site - i.e inserting some lines, executing a query. I normally access the files via ftp connection. And so far the only way I figured I can mess around with the database is to download it and change it on my desktop PC.
Thank You.
Tomáš Pajonk
View 5 Replies
View Related
Jul 20, 2005
Hi allWe have a small database that we host on our own local server. In order toget the information into the database I have a VB program that collates theinformation from a variety of sources and then over our local internalnetwork writes it to the database tables.This information is then made available over the internet using thecompanies broadband connection. In order to alleviate bandwidth issues weare looking at paying for someone else to host the database.What I am hoping to achieve is to keep the VB software, but during the nightupload the data to the remotely hosted SQL server using say a series ofupdate statements. Does anyone know if this is possible, and will SQL Serverlook after the integratory of the data. Is there any issues with therelatively low speed of then Internet as compared with a local networkenvironment. The amount of data we are looking at moving is very little,some where in the region of a few hundred records per night split over about10 tables.many thanksAndy
View 1 Replies
View Related
Sep 11, 2007
I'm not sure this is the exact forum in which to ask this question, so if there is a more appropriate forum, please point me in that direction.
Basically I'm looking for advice and best practices for dealing with an upgrade plan for a hosted database. Here is the situation:
- Hosted software application (.Net)
- Uses SQL Server 2005
- When we upgrade the software application to a new version, there will be schema and data changes that need to be applied to the database
- For the software application, we have considered upgrading an offline machine and then switching old one instantaneously.
- For the database, I'm trying to figure out if we can keep everything live for upgrades, or if we should have a small amount of scheduled downtime to upgrade.
So we have identified 2 basic directions:
1) Keep the database live and apply the new script changes just after the application software is upgraded. This means zero downtime, but we'd have to design and test our application to be backward compatible, so that the new version of the application code could handle both the new schema design, and the old schema design. It seems that this option would add a huge amount of complexity because we would essentially be testing a 3rd app/schema combination.
2) Take a small amount of scheduled downtime and upgrade the application code and database all at once.
Obviously option #2 is the most desirable from a development process point of view, and #1 is the most desirable option from a business point of view (zero downtime).
So, I'm looking for some advice on this. Do most people take the whole system down? Are there 100% live systems that deal with this? Are there other approaches I'm not considering?
Any information would be greatly appreciated. Thanks.
View 4 Replies
View Related
Feb 29, 2008
I am trying to use a new microsoft add-in for office 2007. I installed the 180 day trial version of SQL Server 2005 and according to the instructions it was suppose to be very easy to connect the add in to SQL. I am receiving an error message which I cannot find a resolution to using the readme file and wonder if you can help. Here is the url to the readme file and a screenshot with a summary of the add in.
http://download.microsoft.com/download/5/0/e/50ec0a69-d69e-4962-b2c9-80bbad125641/ReadmeSQL2005.htm
http://download.microsoft.com/download/5/0/e/50ec0a69-d69e-4962-b2c9-80bbad125641/ReadmeSQL2005.htm#_3461_accessing_setup_documentation_cuy1
http://download.microsoft.com/download/5/0/e/50ec0a69-d69e-4962-b2c9-80bbad125641/RequirementsSQL2005.htm
http://www.microsoft.com/sql/technologies/dm/addins.mspx
ERROR MESSAGE
Unable to connect to server 'localhost'. Please make sure user 'ARTIMUSArt McCarty' has at least read permission to some database on the server.
DETAILS ON TH ADDIN
The SQL Server 2005 Data Mining Add-ins for Office 2007 allow you to uncover hidden patterns and relationships in your data and then put them to work to enhance the quality of your analysis.
The package you downloaded allows you to install the following add-ins:
Table Analysis Tools for Excel
With a couple of mouse clicks you can detect and analyze the key influential factors for values in your data, highlight values that don't fit with the rest of the data. More
Data Mining Client for Excel
Go through the full data mining model development lifecycle within Excel by using your spreadsheet data, or by using external data accessible through your Analysis Services database. More
Data Mining Templates for Visio
Render and share your mining models as Visio drawings that you can annotate. More
Thanks for your help.
Art
View 1 Replies
View Related
May 2, 2008
Dear guys
I want to publish my web site and sql server on a hosted server. But i'm worried about people behind the server. all of my codes including web and stored procedures of sql server are open. as far as I know, there is no effective way to protect web pages source. how about sql server? I mean compiling stored procedures.
and another important thing is data. I think certain people have potential to see or change all of my records, or for example give email address of my customers to a third party or ... .
Is there any way?
View 4 Replies
View Related
Sep 18, 2006
I'm not experienced with SQL Server 2005.I've got a live copy of my database running on the web server.I've got another copy running on my desktop that I make changes to.Whats the best way to sync between the two so:1. I don't have to take the application offline2. I don't loose any data from the live database3. But I can implement changes to tables and/or add new tables
View 1 Replies
View Related
Dec 24, 2007
Hi everybody,
Currently we have a MIS application, developed in VB 6.0 - SQL Server 2000 platform, which is used by around 60 users in our office.
We are planning to host a website remotely, which would allow clients to place orders, track order status etc. on it.
Would it be possible to access our local SQL database from the remote website?
View 4 Replies
View Related
Nov 2, 2007
I have a web app that uses two SQL Express databases. One of the databases is the membership database. I am deploying the app to a hosted environment. Here is my connection string:
<add name="Akamojo_APSNETDB" connectionString="Data Source=.SQLExpress; AttachDBFileName=|DataDirectory|Akamojo_ASPNETDB.mdf; Initial Catalog=Akamojo_ASPNETDB; Integrated Security=true; User Instance=true"/>
Here is the error that I get:
Could not open new database 'Akamojo_ASPNETDB'. CREATE DATABASE is aborted.
Cannot attach the file 'e:hostingmemberakamojoTournamentLogApp_DataAkamojo_ASPNETDB.mdf' as database 'Akamojo_ASPNETDB'.
File activation failure. The physical file name "c:inetpubwwwrootTournamentLogApp_DataAkamojo_ASPNETDB_log.LDF" may be incorrect.
The log cannot be rebuilt when the primary file is read-only.
The mdf file is not read only. In the hosted environment the database is on the E drive. In my dev environment the database is on the C drive. From the error message, it appears that when it tries to build the log file it is trying to build it on the C drive in a path that doesn't exist in the hosted environment.
Any help is greatly appreciated.
-Darrell
View 1 Replies
View Related
Jan 12, 2007
I am running the Office Professional Plus 2007 RTM with all options enabled and SQL 2005 Enterprise Edition. Based on the system requirements listed on the download page for the Office 2007 Data Mining Add-In, I've also verified that I have the correct CTP of SQL 2005 SP2 and that .Net 2.0 Framework is installed. Finally, I've verified that my local instance of SQL Server is configured correctly to allow temporary data mining models.
In Excel, all of the Table Analysis tools seem to work fine, and most of the options on the Data Mining ribbon also work; however, all of the options under "Data Modeling" on the Data Mining ribbon return the following error when I try to use them:
"Could not load file or assembly 'Microsoft.DataWarehouse, Version=9.0.242.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91' or one of its dependents. The system cannot find the file specified."
Please help. Thanks.
View 4 Replies
View Related
May 2, 2007
Hi, all experts here,
Thank you for your kind attention.
Data mining add-in for Office Visio 2007 is great. But what I am concerning is-to end users (to technical users) how could we deliver the data mining models results in a better way (e.g. integrate with other possible clients ) to make it dynamically and easily undertood?
Hope my question is clear for your help.
With best regards,
Yours sincerely,
View 3 Replies
View Related
Mar 3, 2008
after i installed sql server 2005 DM add-ins, i tried using it with office 2007 so i choose (start---->all programs----->microsoft sql 2005 dm add-ins---->getting started) so the getting started wizzard was opened, i selected from it (use an existing instance of microsoft sql server 2005 analysis services that i adminster) because i already had a version of it installed on my computer. then i tried to connect to analysis services by selecting 'server name'=local host, an error appeared which is "unable to discover meta data on the server 'local host' . user noha needs to be adminstrator of the server to run the configuration tool". how can i be the adminstrator of the server?????????.........plz reply me soon,thanks in advance
View 6 Replies
View Related
Oct 21, 2007
Hi Raman,
Hope you are doing good. I used Data Mining Add-ins (Office 2007) lab in teched whihc you have designed. I wanted to re-do it. But I do not have the .xlsx file that it uses in the lab. Can you or anyone else please assist with the file? Thank you so much.
Regards
Vijat
View 1 Replies
View Related
Mar 1, 2008
I am trying to use a new Excel microsoft add-in using SQL server 2005. I installed the 180 day trial version of SQL Server 2005 on my local machine and according to the instructions it was suppose to be very easy to connect the excel add in to SQL. I am receiving an error message which I cannot find a resolution to using the readme file and wonder if you can help.
ERROR MESSAGE
Unable to connect to server 'localhost'. Please make sure user 'ARTIMUS' has at least read permission to some database on the server.
THanks for your help!
Art
View 6 Replies
View Related
Oct 3, 2005
Hello all,
I hope someone can help with my current issue as i have now spent the last 8
hours trying to solve it! Here goes...
I am currently moving all my websites from our in house set up to a FASTHOSTS
dedicated server. Our in house set up consists of separate server for web
and data and works well even with my recent foray into .Net sites.
I have just moved the most recent of my .Net sites
(http://www.alfadealerads.co.uk/home.aspx) to the FASTHOSTS server and cannot
get the site to connect to the database (this has also been installed on the
FASTHOSTS server). One of the pages that connects to the DB is
http://www.alfadealerads.co.uk/links.aspx, where i am getting the error..
System.Data.SqlClient.SqlException: Cannot open database requested in login
'MasseratiChauffeurDrive'. Login fails.
Login failed for user 'lateral'.
This DB has been restored from back up from the original DB. I have
recreated the user name on the new SQL server and added it to the new DB
also. I am using a webconfig to connect to the DB, the exact same one
that works on my current live server
(http://www.maseratichauffeurdrive.com/home.aspx) only with the obvious change
to the SQL server name.
The only difference i can see in the 2 setups is that the new one has both the
webserver and the SQL server on the one machine and that machine uses domains.
My current in house setup does not use domains and as mentioned before web and
date are 2 separate servers.
Can anyone help? Or even understand what the hell i have written? lol
Thanks in advance
View 3 Replies
View Related
Jun 3, 2015
SQL server, by-mistake I updated values of a column in a database hosted online, is there any way undo the transaction. I didn't created any backup of the database. I read that still it can be recovered through the .ldf (log file) but unable to access it. Is there anyway to get access of the Log file or is there any way to recover the data.
View 1 Replies
View Related
Apr 25, 2007
Hi , all Microsoft BI experts here,
Thanks for your kind attention.
I am having a question as stated in the subject title, yes, when we want to deploy scorecards to reporting services, as the prerequisite, how can we install and register the scorecard custom data processing extension with the Microsoft reporting services server?
I am looking forward to hearing from you shortly and thank you again.
With best regards,
Yours sincerely,
View 1 Replies
View Related
Apr 15, 2007
Hi,
I have two SQL Express database and I want to do two things. One is to transfer a table over to the other database. Two, move the files from one table in one database to another. Please let me know when you get a chance.
Thanks,
Kyle
View 8 Replies
View Related
Apr 17, 2007
Hi,all BI experts here,
Thank you very much for your kind attention.
I am having a problem with connecting to SQL Server 2005 database from Office Business Scorecard Manager 2005 (the connection string i am using is: provider=SQLOLEDB;Data source=server_name; Initial catalog=database_name). But the connection failed. Would please any experts here shed me any light on what is the problem and how to fix it then? As there is no any forum for Office Business Scrorecard manager 2005. Therefore I post my thread here as it is related to the connection to SQL Server 2005 database engine, thought here is the best place for this question.
Thank you very in advance for your kind advices and help. And I am looking forward to hearing from you soon.
With best regards,
Yours sincerely,
View 6 Replies
View Related
Feb 27, 2007
What is wrong with this code the dropdowlist mainlyusing System;using System.Data;using System.Configuration;using System.Collections;using System.Web;using System.Web.Security;using System.Web.UI;using System.Web.UI.WebControls;using System.Web.UI.WebControls.WebParts;using System.Web.UI.HtmlControls;using System.Data.SqlClient;public partial class NewAccount : System.Web.UI.Page{ protected void Page_Load(object sender, EventArgs e) { } protected void NaccountButton_Click(object sender, EventArgs e) { if (Page.IsValid) { //Define data objects SqlConnection conn; SqlCommand comm; //read from web config string connectionString = ConfigurationManager.ConnectionStrings["OneBank"].ConnectionString; //Initialize connection conn = new SqlConnection(connectionString); //create command comm =new SqlCommand( "INSERT INTO Customer (FirstName, LastName, Street, City, State," + "Zip, Phone, Payee,AccountType)" + "VALUES(FirstName, LastName, Street, City," + "State, Zip, Phone, Payee,AccountType)", conn); //add parameters comm.Parameters.Add("@FirstName", System.Data.SqlDbType.NVarChar, 50); comm.Parameters["@FirstName"].Value=Firstname.Text; comm.Parameters.Add("@LastName", System.Data.SqlDbType.NVarChar, 50); comm.Parameters["@LastName"].Value=lastname.Text; comm.Parameters.Add("@Street", System.Data.SqlDbType.NVarChar, 50); comm.Parameters["@Street"].Value=street.Text; comm.Parameters.Add("@City", System.Data.SqlDbType.NVarChar, 50); comm.Parameters["@City"].Value=city.Text; comm.Parameters.Add("@State", System.Data.SqlDbType.NVarChar, 50); comm.Parameters["@State"].Value=state.Text; comm.Parameters.Add("@Phone", System.Data.SqlDbType.Int); comm.Parameters["@Phone"].Value=phone.Text; comm.Parameters.Add("@AccountType", System.Data.SqlDbType.NVarChar, 50); comm.Parameters["AccountType"].Value = dropdownlist1.SelectedValue.ToString(); //Enclose database in try catc finally try { //open connection conn.Open(); //execute the command comm.ExecuteNonQuery(); //reload query Response.Redirect("NewAccount.aspx"); } catch { //Display error Errormessage.Text= "Error submitting request!"; } finally { conn.Close(); } } }}
This is the table where thisis going
customer ------------- customerID pk generated automatically firtsname lastname street city statezipphoneaccountType
View 3 Replies
View Related
Jul 21, 2005
I have a table changereport and network info.i insert a record with date of insertion plus chagereport id.then I have a xml file
<ChangeReport> <Network-Info> <Version> 2.0</Version> <Highest-Ver> 2.0</Highest-Ver> <Description> WinSock 2.0</Description> <System-Status> Running</System-Status> <Max> 2.0</Max> <IP-address> 192.168.142.1</IP-address> <Domain-Name> samin</Domain-Name> <UDP-Max> 2.0</UDP-Max> <Computer-Name> SAMIN</Computer-Name> <User-Name> samin</User-Name> </Network-Info></ChangeReport>
I want's to insert a record in network info table where field name are nodes name data should be the one against those nodes in xml file .How can I do it I am using sql server
View 2 Replies
View Related
Feb 21, 2006
What have I done wrong with this script?I'm getting an error The ConnectionString property has not been initialized.
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.InvalidOperationException: The ConnectionString property has not been initialized.
Source Error:
Line 73: myCommand.Parameters.Add(New SqlParameter("@Activationcode", SqlDbType.nVarChar, 50))Line 74: myCommand.Parameters("@Activationcode").value = activecode.valueLine 75: myCommand.Connection.open()Line 76: tryLine 77: myCommand.ExecuteNonQuery()
Dim loConn as New SqlConnection(ConfigurationSettings.AppSettings("MM_CONNECTION_STRING_HWB"))Dim myCommand as SqlCommandDim InsertCmd as StringinsertCmd = "insert into Login values (@Username, @Password, @email, @Activationcode);"myCommand = New SqlCommand(InsertCmd, loConn)myCommand.Parameters.Add(New SqlParameter("@Username", SqlDbType.nVarChar, 50))myCommand.Parameters("@Username").value = Username.valuemyCommand.Parameters.Add(New SqlParameter("@Password", SqlDbType.nVarChar, 50))myCommand.Parameters("@Password").value = Password.valuemyCommand.Parameters.Add(New SqlParameter("@email", SqlDbType.nVarChar, 50))myCommand.Parameters("@email").value = email.valuemyCommand.Parameters.Add(New SqlParameter("@Activationcode", SqlDbType.nVarChar, 50))myCommand.Parameters("@Activationcode").value = activecode.valuemyCommand.Connection.open()myCommand.ExecuteNonQuery()myCommand.Connection.Close()
View 1 Replies
View Related
Apr 10, 2006
hi
It seems that my code can insert data into memory, but not into the database. What I mean is that after "insert data", I can "read data",
which I just insert. When I check the actual database table, it didn't
get updated.
I am using VS 2005 and table designer. Regarding to this problem, is
it related to any setting of setup of the database? I check the code,
and I have no idea how it occurs.
private static string connectionString = null;
private static SqlConnection connection = null;
private static string commandString = null;
private static SqlCommand command = null;
private static SqlDataReader reader = null;
static void Main(string[] args)
{
connectionString = ConfigurationManager
.ConnectionStrings["appDatabase.Properties.Settings.databaseConnection String"]
.ConnectionString;
connection = new SqlConnection(connectionString);
try
{
// Insert data
commandString = @"INSERT INTO userTable
(userID, permissionLevel, mobile, emailAddress, mailAddress, pager) VALUES(1, 2, '123', 'aa@a.com', 'oz', 'no')";
SqlCommand command = new SqlCommand(commandString, connection);
connection.Open();
command.ExecuteNonQuery();
connection.Close();
// Read data
commandString = @"select * from userTable";
command = new SqlCommand(commandString, connection);
connection.Open();
reader = command.ExecuteReader();
while (reader.Read())
{
Console.WriteLine(reader["permissionLevel"].ToString());
}
connection.Close();
}
catch (Exception e)
{
Console.WriteLine(e.ToString());
}
regards
figo2476
View 5 Replies
View Related
Apr 8, 2008
how to insert data from asp page into sql database using visual basic?????
View 3 Replies
View Related
Sep 18, 2007
Ok what i am looking to do i cannot figure out.
What i want to do is have a simple script that when a user logs onto the website (via windows auth) to get there username somehow llike with
Request.ServerVariables("LOGON_USER")
that should display there username either "domain/name" or "username"
and then insert that into the UserLogs Table under my database with the date with the GETDATE() command..
But when i do this i cannot get the page to auto submit the values. Actually i cannot get anything to write to the DB unless i am doing it under the query builder.
Here is my Query that i was using.
INSERT INTO UserLogs([User], Date) VALUES (@UserName, GETDATE())
then in the Code of the page i have
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="SubmitForm.aspx.vb" Inherits="Template_SubmitForm" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server"><title>Untitled Page</title>
</head>
<body><% Dim name
name = Request.ServerVariables("LOGON_USER")%>
<form id="form1" runat="server">
<asp:SqlDataSource ID="SqlDataSource2" runat="server" ConnectionString="<%$ ConnectionStrings:REPCOMConnectionString %>"
InsertCommand="INSERT INTO UserLogs([User], Date) VALUES (@name, GETDATE())"
SelectCommand="SELECT [User], Date FROM UserLogs" CancelSelectOnNullParameter="False">
<InsertParameters>
<asp:SessionParameter DefaultValue="test1234" Name="name" SessionField="name" />
</InsertParameters>
</asp:SqlDataSource>
</form>
</body>
</html>
So i know i am doing something wrong but what?
Thank You,
Corey
View 1 Replies
View Related
Dec 26, 2007
Hallow
My code does not insert Data into Database, please can someone look on it and give a technical problem over here please
It does not generate any error please, when I CLICK THE BUTTON IT DOES NOT GENERATE ERROR, IT GIVE ME THE MESSAGE THAT ITEM ADDED, BUT WHEN I LOOK MY TABLE NOTHING ID INSIDE Sub Add_To_Cart(ByVal Src As Object, ByVal Args As EventArgs)
Dim FVProductID As Label = FormView1.FindControl("ProductID")
Dim FVProductName As Label = FormView1.FindControl("ProductName")Dim FVProductPrice As Label = FormView1.FindControl("ProductPrice")
Dim DBConnection As SqlConnection Dim DBCommand As SqlCommand
Dim sql As String
Dim SQLAddString As String
DBConnection = New SqlConnection("Data Source=MANDARISQLEXPRESS;Initial Catalog=SHOES;Integrated Security=True")
DBConnection.Open()
If Not Session("OrderID") Is Nothing Then
sql = "SELECT Count(*) FROM ShoppingCart " & _ "WHERE OrderID = '" & CType(Session("OrderID"), String) & "' " _
& "AND ProductID = '" & FVProductID.Text & "'"
DBCommand = New SqlCommand(sql, DBConnection)
If DBCommand.ExecuteScalar() = 0 Then
SQLAddString = "INSERT INTO ShoppingCart (OrderID, ProductID, OrderDate, ProductName, ProductPrice, ProductQnty) VALUES (" & _
"'" & CType(Session("OrderID"), String) & "', " & _"'" & FVProductID.Text & "', " & _
"'" & Today() & "', " & _"'" & FVProductName.Text & "', " & _
"'" & FVProductPrice.Text & "', 1)"DBCommand = New SqlCommand(SQLAddString, DBConnection)
DBCommand.ExecuteNonQuery()
End If
End If
DBConnection.Close()
Src.Text = "Item Added"Src.ForeColor = Color.FromName("#990000") Src.BackColor = Color.FromName("#E0E0E0")
Src.Font.Bold = True
End Sub
View 3 Replies
View Related