Okay With Reading, But Problems With Updating The Database

Feb 20, 2008

Hello,
I'm successfully using SqlDatSource to read data from SQL Server on a networked machine. Obviously I'd like to be able to update, edit or delete data, but the 'Advanced Sql Generation Options' in the SqlDatSource are greyed out.
The result is that when I try and edit, update or delete I get this message Updating is not supported by data source 'SqlDataSourceDetails' unless
UpdateCommand is specified. Which makes sense because the options havn't been specified.

I'm thinking this is probably a server side permissions issue but I've been through everything I can see and am now basically stuck.
Any help would be appreciated 
 Many thanks 

View 7 Replies


ADVERTISEMENT

Help With Reading Database.

Jun 29, 2005

I have this code that I hacked together from someone else's example.  I kind of understand how it works.  I just don't know if it will and i am not in a location right now to check.  I was wondering if I did this correctly first, second how can it improve and should i do something different.  Basically i just want to check the password in a database. I am passing the username and password to this function from another functioprivate bool authUser(string UserName, string Password){ string connectionString = ConfigurationSettings.AppSettings["DBConnectionString"];  SqlConnection DBConnection = new SqlConnection(connectionString);  bool result = false;  DBConnection.open() SqlCommand checkCommand = new SqlCommand("SELECT password FROM Users WHERE userName='" + Password + "', DBConnection) SqlDataReader checkDataReader = checkCommand.ExecuteReader();
 if(checkDataReader.GetString(0) == Password) {  result = true; } else {  result = false; } checkDataReader.Close(); DBConnection.Close();
 return result;}Thank you Buddy Lindsey

View 6 Replies View Related

Reading Database Question..

Mar 15, 2008

Hello all!

I am currently building a website and have reached a brickwall called SQL..

I hope this is ok to post on this forum I wasn't sure if I had come to the right place!

Basically I have an SQL database on my server and I would like to have my website access it and update information on a page i.e. :

Item Name: Quantity Sold: Price:
T-shirt 50 $10
Jeans 25 £20

How easy is such a thing to do as I have a very limited knowledge of SQL and especially incorporating it into web code..

Thanks!

jake

View 2 Replies View Related

Reading Blob From Sql Server Database

Jul 7, 2006

Hello,
I could save the file in the sql server database. The problem i am having is, I am not able to read the document from the database. I do not want to use response.outputstream......
I have to read the file for specific contents. Anyhelp would be great.
- Suresh
 

View 2 Replies View Related

Connecting To And Reading Data From A SQL Database

Jul 25, 2006

Hi Everyone,
I am looking for some help, as i am pulling my hair out looking for information.
I have been using asp for many years and am now starting to learn .net. so far so good....
I am now wanted to connect to a database, execute a simple select statement and then read/write the information out. I can't help but think in old asp code and i am having a hard time finding what i need to perfom this simple task.
I have used the grid controls etc, and these are very good - however, i need to connect to a database in the code-behind file and perfom various functions in the background.
If any of you could be so kind as to perhaps show me some demo code i would be grateful.
I would like to do:
A) Connect to a database (sql server 2000)B) Execute a simple SQL select statementC) Read the returned informationD) put this information into variables used elsewhereE) how do you check if no records are returned? such as the .EOF in asp?
Many thanks
Darren
 
 

View 1 Replies View Related

Reading Image From SQL 2000 Database

Aug 25, 2007

I am able to upload a jpeg to a sql 2000 database into a column called graphic, the datatype is an image. for some reason i can read the image and have it displayed! this is driving me insane. any help would be greatly appreciated. here is the code to upload. and below that is the code to display the image.UPLOAD CODE        If Not IsNothing(txtfileupload.PostedFile) Then            'Determine File Type            Dim strExtension As String = Path.GetExtension(txtfileupload.PostedFile.FileName).ToLower()            Dim strContentType As String = Nothing            Select Case strExtension                Case ".gif"                    strContentType = "image/gif"                Case ".jpg", ".jpeg", ".jpe"                    strContentType = "image/jpeg"                Case ".png"                    strContentType = "image/png"            End Select                  'Load FileUpload's InputStream into Byte array            Dim imageBytes(txtfileupload.PostedFile.InputStream.Length) As Byte            txtfileupload.PostedFile.InputStream.Read(imageBytes, 0, imageBytes.Length)                                    'INSERT DATA INTO DATABASE            Dim objSQLConn As SqlConnection            Dim strSQL As SqlCommand            objSQLConn = New SqlConnection("server=srvdb1.rrg.local;uid=rsusr;pwd=Letmein123;database=rsdb")            strSQL = New SqlCommand("insert into rsdata (graphic,contenttype,fname,lname,nname) values(@graphic,@contenttype,@fname,@lname,@nname)", objSQLConn)                strSQL.Parameters.AddWithValue("@graphic", imageBytes)            strSQL.Parameters.AddWithValue("@contenttype", strContentType)            strSQL.Parameters.AddWithValue("@fname", txtfname.Text)            strSQL.Parameters.AddWithValue("@lname", txtlname.Text)            strSQL.Parameters.AddWithValue("@nname", txtnname.Text)            objSQLConn.Open()            strSQL.ExecuteNonQuery()            objSQLConn.Close()                lblStatus.Text = "Records uploaded"        End If  CODE TO DISPLAY    Dim objSQLConn As SqlConnection    Dim strSQL As SqlCommand    Dim objSQLDataReader As SqlDataReader        objSQLConn = New SqlConnection("server=srvdb1.rrg.local;uid=rsusr;pwd=Letmein123;database=rsdb")    objSQLConn.Open()    strSQL = New SqlCommand("select graphic, contenttype from rsdata", objSQLConn)    objSQLDataReader = strSQL.ExecuteReader()While objSQLDataReader.Read()        Response.ContentType = objSQLDataReader("contenttype")        Response.BinaryWrite(objSQLDataReader("graphic"))End While        objSQLDataReader.Close()    objSQLConn.Close()%>

View 1 Replies View Related

Timeout Expired While Reading From Database

Mar 27, 2008

Hi all I've a page which shows data (25-30 entries) that are retrieved by an SqlDataSource. The query is very simple since i don't have to join any table.unfortunately sometimes I get the following error message. It's strange, since the page often works fine but the error occurs a couple of times per day.Who has an idea of how I could solve this problem?
 
Server Error in '/' Application.

View 33 Replies View Related

Contraint Violation When Reading From Database

Apr 4, 2008

I have created a typed-dataset AuthorsDataSet and created a table in with name Authors, manually by right-click > New > Table. I have kept the data-types, sizes and contstriants exactly same as the table in the database, though I have kept the Column names different. I am filling the AuthorsDataSet with the following code on Form_Loadif (!IsPostBack)
{      SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["pubsConnectionString"].ConnectionString);
      SqlCommand cmd = new SqlCommand("SELECT au_id, au_lname, au_fname, phone, address, city, state, zip, contract FROM authors", conn);      using (SqlDataAdapter da = new SqlDataAdapter(cmd))
      {
            conn.Open();
            da.Fill(ds.Authors);
            grdAuthors.DataSource = ds.Authors;
            grdAuthors.DataBind();
            conn.Close();
      }
      conn.Dispose();
      cmd.Dispose();
}
The connection string is as follows:<connectionStrings>
      <add name="pubsConnectionString" connectionString="Data Source = localhost; Initial Catalog = pubs; Integrated Security = SSPI"/>
</connectionStrings>
The following error occurs when I run the page
System.Data.ConstraintException: Failed to enable constraints. One or more rows contain values violating non-null, unique, or foreign-key constraints.

View 3 Replies View Related

Reading Or Writing A File To A SQL Database

Nov 22, 2004

Halo, I am a bit new to this
Please can someone help me, I would like to write a file(Any type) to a SQL database like a attached document(s) for the current record and be able to detatch the document when needed.
I use VB.NET for a ASP.NET app.
I basicly would like to attach documents to a piece of equipment may it be any kind and if the user views the equipment he will be able to detatch the documents for that piece of equipment and open it with the correct software.
PLEASE HELP!!!!!!!

View 1 Replies View Related

Arabic Language Not Reading In My Database

Nov 11, 2005

Hi i use sql server 2000 and i found problem in my database that is
when i write arabic language and closing my table and open it again i found all my data like question mark.
what can i do to save my data with arabic language.
note i use windows 2000 server.

View 1 Replies View Related

Problems Reading Data From A Database

Mar 24, 2008

I have a database that contains news items. There's a column that contains the actual article. In that field, there are paragraphs with page breaks. The page breaks in the database are represented as squares (unrecognizable characters I guess). When I try to read in the data, it doesn't recognize the page breaks, and it comes out all in one large paragraph. Is there any way to get around this?

View 2 Replies View Related

Reading/Writing Data From A SQL Database

Feb 14, 2008



Hi,
I have a data structure called 'Quote' which contains a number of different variables and controls ranging from text boxes, check boxes and radio buttons, i need to be able to read and write this from a database.

First I think a description of my overall project is needed:



Project Description
I have been given a brief that basically says: i have to create a programmed solution in VB to solve a problem. This problem can be anything we like, and I personally have chosen to create a program that manages quotes for building Log Cabins (this is very contrived and far from anything someone would do in the real world).

My solution will allow a generic user to create a quote (using a form with controls such as text boxes, check boxes, radio buttons) , and then save this to file. These users may then wish to load/edit this quote at a later date, from another form.

Whilst completing this project, i'll only have up to about 5 records (quotes) within the system, so i dont need the ability to store hundreds of records. And each record will be relatively short, with only about 10-15 data items within the data structure.

Also the Admin (or business owner in this case) need to be able to view all saved quotes in a presentable format, and edit them if needs be, from within this same program.

This solution does not need to be absolutely perfect and 100% efficiently coded, or have all the bells and whistles a real-world program would have. This is for an A level computing project by the way.





So basically, i need to be able to read from the database (to populate a Data Grid (i imagine this is best way?)) and so Admin can access any quote and edit it (editing is not vital, but viewing/printing is. Maybe i should stop at just viewing any quote?). Also i need generic users to be able to fill in the Edit Quote form and then save this data into the database.

And is a data structure really required for me to use a database?

I've never used databases in VB before (but have used them elsewhere, mainly Access) and so am completely new to this. Any help will be much appreciated.
Thanks

View 13 Replies View Related

Reading Data From A String Into A SQL Database

Jan 18, 2007

Hi, i'm writing a SOCKET Port Listener for a Database, it must be multi-threaded and listen on a port for a record that when it comes in, it must write the record to the SQL database (MS SQL Server). I've got the listener to read the data over the port already and write the record into a string which i have already sliced up. Now i need to create a connection to the database and insert the variables into the database.

If Someone will please be able to give me a rough idea of how i could accomplish this with some sample code, then i will be greatful, i'm new to C#, but here is my code that i have so far.

//This is the Connection that i have made and where i am currently stuck, i dunno how to go further. Any help will be welcome.

public class ConnectionToMSDatabase
{
public void InsertDataIntoDatabase(string TableName, string connectionString, string dataFields)
{
string InsertSQLStatement;
InsertSQLStatement = "INSERT INTO " + TableName + " VALUES (" + dataFields + ")";

OleDbConnection ConnectionToDatabase = new OleDbConnection(connectionString);
ConnectionToDatabase.Open();
OleDbCommand command = new OleDbCommand();
command.Connection = ConnectionToDatabase;
command.CommandText = InsertSQLStatement;
command.ExecuteNonQuery();
command.Connection.Close();
}
}


//Here is my connection string, all the retrieved data is stored in a string array call fullRecord

ConnectionStringToDatabase = "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;User ID=" +
"Administrator" + ";Initial Catalog=FORGE;Data Source=FORGE";

View 4 Replies View Related

Reading Data From Text File Database

Jun 6, 2007

 Hi everyone I have a directory that contains a lot of text files that have data I need to draw from.  I want to know if it is possible to write a program that will read all of the text files in the directory and pull out data and save it to a new textfile. For example: Each text file is formatted this wayColumn1, Column2, Column3"1","xxxx","yyyy""2", "xxxx", "yyyy""3", "XXXX", "yyyy" I want to put all lines that begin with 1 in one text file, all the lines that begin with two in another text file, and the same with all lines that begin with 3. my problem is I want to be able to point at the folder that contains those files and have it read every text file in the folder and perform the operation.  If this is possible can someone point me in the right direction on how to get started.Thank you for any help!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 

View 1 Replies View Related

Invalid Object Name While Reading Data Out Of An SQL Database

Jan 4, 2006

Hi all,I'm a complete newbie on ASP.Net.I want to get some data out of a SQLserver Database running on my system with SQL Server 2005 Express. The name of the Database is 'tempdb' and the table is called "Members". the SQLServer runs as Local System with the Windows account.When I try to open the site, I always get the same error:Invalid object name 'Members'I don't know what to do anymore. I read a post, where anybody set the rights for the owner, but my database is running with the Windows account.Here is the Code of the page so far:<%@ Page Language="VB" Debug="True" Strict="True" %><%@ Import Namespace="System.Data" %><%@ Import Namespace="System.Data.SQlClient" %><script runat="server">Sub Page_Load (ByVal Sender As Object, _ ByVal E As EventArgs) Dim connStr As String connStr = "Provider=Microsoft.Jet.OLEDB.4.0;" connStr += "database=tempdb;" connStr += "Truster_Connection=yes"
Dim conn As New SQLConnection(connStr) conn.Open() Dim sql As String sql = "SELECT COUNT (*) FROM Members" Dim cmd As New SQLCommand(sql, conn) Dim ergebnis As String ergebnis = cmd.ExecuteScalar().toString() Dim t As String t = "Die Tabelle Members hat " & _ ergebnis & " Zeilen. <br>" & _ "Das Kommando lautet: " & _ cmd.CommandText & "<br>" & _ "Der Kommandotyp ist: " & _ cmd.CommandType ausgabe.innerHTML = t End Sub</script><html><head><title>Demo zu SQLCommand.ExecuteScalar</title></head><body><h3>Demo zu SQLCommand.ExecuteScalar</h3><p runat="server" id="ausgabe" /></body></html>Thanks for your help an sorry for my english.GreetsFlash_Prince

View 4 Replies View Related

Updating A Production Database With Back Up Of Development Database

May 11, 2007

Can someone provide a step by step tutorial for this? I'd like to safely update a database that is used for a website without much or any downtime.

View 1 Replies View Related

Updating Online SQL 2005 Database From Local Database

Jan 30, 2007

I have my first small SQl Server 2005 database developed on my localserver and I have also its equivalent as an online database.I wish to update the local database (using and asp.net interface) andthen to upload the data (at least the amended data, but given thesmall size all data should be no trouble) to the online database.I think replication is the straight answer but I have no experience ofthis and I am wondering what else I might use which might be lesscomplicated. One solution is DTS (using SQL 2000 terms) but i am notsure if I can set this up (1) to overwrite existing tables and (2) notto seemingly remove identity attributes from fields set as identities.I know there are other possibilities but I would be glad of advice asto the likely best method for a small database updated perhaps onceweekly or at less frequent intervals,Best wishes, John Morgan

View 3 Replies View Related

Updating A Table On My Hosted Database From A Local Database

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

Updating Sql Database From Linked Access Database

Jul 1, 2004

I got thrown into a new project that is going to require me to update an SQL server database tables from an Access table on the backend of an Oracle database on another server. At the end of each day the Access dabase will be updated from the Oracle database.

What I need to do, is when the Access database is updated I need to have the table in the SQL database automaticaly updated. When a new record is added to the Access table I need the new record added to the SQL table. When a record is deleted in the Access table I need to keep that record in the SQL table and set a field to a value (such as 0). And when a record is updated in Access, have it updated in SQL.

Needless to say this is a bit out of my area and not sure how to accomplish this.

Any help is greatly appreciated.

View 2 Replies View Related

Updating Sql 2000 Database From Sql 2005 Database

Jul 27, 2006

i have sql 2005 installed on my personal machine, but our server has sql 2000 on it. the structure of my database was made on the server, but i'm not sure how to update the server copy from my local copy. when i try to export my data from my local machine to the server (or import from my local machine to the server), i get pre-execute errors.

roughly every other week, i'll need to be able to update the server version from my local version, so i'm trying to find the most efficient method. what is the best way to update a 2000 database from a 2005 database? it doesn't matter if i append or overwrite, but i do use identity fields. the error i get when trying to use the import/export wizard is:



- Pre-execute (Error)



Messages

Error 0xc0202009: Data Flow Task: An OLE DB error has occurred. Error code: 0x80040E21.
An OLE DB record is available. Source: "Microsoft SQL Native Client" Hresult: 0x80040E21 Description: "Multiple-step OLE DB operation generated errors. Check each OLE DB status value, if available. No work was done.".
(SQL Server Import and Export Wizard)


Error 0xc0202025: Data Flow Task: Cannot create an OLE DB accessor. Verify that the column metadata is valid.
(SQL Server Import and Export Wizard)


Error 0xc004701a: Data Flow Task: component "Destination 3 - ReleaseNotes" (202) failed the pre-execute phase and returned error code 0xC0202025.
(SQL Server Import and Export Wizard)

View 4 Replies View Related

Reporting Services :: Unable To Show Images From Folder By Reading Path From Database In SSRS Report

Apr 28, 2015

Basically i have 3 images capacity per record in my asp.net application. In there i am saving the image path with record id in database and image in my application folder.

Now i am creating SSRS Report in Report builder . In there i have taken one image control to show the images. In the Image properties in report builder i have chosen database under the select the image source field. then inside use this field i have chosen image url and in use this MIME Type i have selected image/jpeg. Now i have saved this report in report server folder.

Now while calling in .net web from through report viewer control. It is opening the report but wont showing the image.

View 2 Replies View Related

Updating The Database

Mar 7, 2007

Hi All:

Appreciate your efforts in answering queries of so many newbees!I hope to find answering my query..I
have created a logon screen to which i have also given the option of
changing the password ... Now below is the code for updating the new
password given by the user ....Imports System.Data.SqlClient     Dim con As New SqlConnection("server=sys2;initial catalog=kris;integrated security=SSPI")    Dim cmd As New SqlCommand("select * from u_login", con)      Dim dr As SqlDataReader    Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load    End Sub    Private Sub btnUpdate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSubmit.Click        con.Open()        dr = cmd.ExecuteReader        While dr.Read()            If dr(0) = txtEmail.Text And dr(1) = txtoldpwd.Text Then                Dim NewPwdStr As String = txtnewpwd.Text                Dim OldPwdStr As String = txtoldpwd.Text                Dim sqlstr As String = "Update U_Login set pwd = ('" & NewPwdStr & "') Where pwd = '" & OldPwdStr & "'"                Dim cmd1 As New SqlCommand("sqlstr", con)                                        cmd1.ExecuteNonQuery()                Response.Write(" Password Changed ... Please login again")            End If        End While        dr.Close()        con.Close()    End Sub The above code although doesnt
throw any error however it shows a blank screen and doesnt even update
the new password. Can you plz help me understand what could possibly be
wrong in my code n why is that am getting the blank screen. Your help will be highly appreciated!Thanks,Brandy

View 6 Replies View Related

Updating A Sql Database From Asp.net

May 25, 2005

Im sorry for how simple this question is im.. brand new at this.I am trying to write a program that will take information entered in 4 txt fields on a webform and populate a sql database with them with a submit button..   Eventually its going to be a updateable phone list for my department but for now im just trying to get the submit button to work.  More then anything i just need a good resourse to read up on it. Thankyou Adam

View 2 Replies View Related

Updating The Database

Nov 15, 2003

At present I am working on a school project. the project was installed few months back. database is MSsql server.
Because of some new things i had to change few tables, add few columns and add few tables also. Now My problem is that the school is already having the data which they don't want to be disturbed . So I want My structure and their data.

:confused: :(
Please Help Me.

View 4 Replies View Related

Updating The Database

Jul 20, 2005

I'm having a difficult time calling UPDATE when my 'WHERE" clause calls ID,which is numeric and the primary key. I found that I can do a SELECT justfine with "WHERE ID".. Is there something special about UPDATE that i'm notgetting? I've searched the internet but it appears that what I'm doingshould work.Any help would be greatly appreciated.if (modcustomer == "relate"){var modid1 = Request.Form ("modid1");var modid2 = Request.Form ("modid2");var relationship = Request.Form ("relationship");var comments = Request.Form("comments");SqlString = "UPDATE Customer SET Relationship = ' " + relationship + " 'WHERE ID = " + modid1;connection.Execute (SqlString);}thanks,Debbie EhrlichReliable Software - Developers of Code Co-op®, Server-less version controlfor distributed teams www.relisoft.com

View 3 Replies View Related

Updating Database

May 17, 2006

Can someone please tell me what I am missing... I am trying to update a record with information a user types into a textbox. I am not getting any errors even when in DEBUG mode. But yet the Data is not getting updated.

Any Help would be very much appreciated.

T

CODE:

Protected Sub bUpdateSlsNum_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles bUpdateSlsNum.Click

Dim myCommand As SqlCommand

Dim myConnection As SqlConnection

myConnection = New SqlConnection("Server=.SQLEXPRESS;AttachDbFilename=|DataDirectory|CustomerInfo.mdf;Integrated Security=True;User Instance=True")

Dim UpdateCmd As String = "UPDATE CustomerSalesNum SET WorkSheetID=@WorkSheetID, Price=@Price, Freight=@Freight, Setup=@Setup, " _

& "Injection=@Injection, Wheels=@Wheels, Security=@Security, SubTotal=@SubTotal, DocFee=@DocFee, TradeInAllow=@TradeInAllow, TaxAmount=@TaxAmount, SalesTax=@SalesTax, " _

& "TradeLienBal=@TradeLienBal, Other=@Other, PAQuote=@PAQuote, TitleFee=@TitleFee, DownPay=@DownPay, Total=@Total WHERE [WorkSheetID]= '" & "@" & lblRWorkSheetID.Text & "'"

myCommand = New SqlCommand(UpdateCmd, myConnection)

myCommand.Parameters.Add(New SqlParameter("@WorkSheetID", Data.SqlDbType.NVarChar))

myCommand.Parameters("@WorkSheetID").Value = lblRWorkSheetID.Text

myCommand.Parameters.Add(New SqlParameter("@Price", Data.SqlDbType.NVarChar))

myCommand.Parameters("@Price").Value = tbUPPRice.Text

myCommand.Parameters.Add(New SqlParameter("@Freight", Data.SqlDbType.NVarChar))

myCommand.Parameters("@Freight").Value = tbUPFreight.Text

myCommand.Parameters.Add(New SqlParameter("@Setup", Data.SqlDbType.NVarChar))

myCommand.Parameters("@Setup").Value = tbUPSetup.Text

myCommand.Parameters.Add(New SqlParameter("@Injection", Data.SqlDbType.NVarChar))

myCommand.Parameters("@Injection").Value = tbUPInjection.Text

myCommand.Parameters.Add(New SqlParameter("@Wheels", Data.SqlDbType.NVarChar))

myCommand.Parameters("@Wheels").Value = tbUPWheels.Text

myCommand.Parameters.Add(New SqlParameter("@Security", Data.SqlDbType.NVarChar))

myCommand.Parameters("@Security").Value = tbUPFactorySec.Text

myCommand.Parameters.Add(New SqlParameter("@SubTotal", Data.SqlDbType.NVarChar))

myCommand.Parameters("@SubTotal").Value = tbUPSUBT.Text

myCommand.Parameters.Add(New SqlParameter("@DocFee", Data.SqlDbType.NVarChar))

myCommand.Parameters("@DocFee").Value = tbUPDOCFee.Text

myCommand.Parameters.Add(New SqlParameter("@TradeInAllow", Data.SqlDbType.NVarChar))

myCommand.Parameters("@TradeInAllow").Value = tbUPTIA.Text

myCommand.Parameters.Add(New SqlParameter("@TaxAmount", Data.SqlDbType.NVarChar))

myCommand.Parameters("@TaxAmount").Value = tbUPTAX.Text

myCommand.Parameters.Add(New SqlParameter("@SalesTax", Data.SqlDbType.NVarChar))

myCommand.Parameters("@SalesTax").Value = tbUPSALETAX.Text

myCommand.Parameters.Add(New SqlParameter("@TradeLienBal", Data.SqlDbType.NVarChar))

myCommand.Parameters("@TradeLienBal").Value = tbUPTILB.Text

myCommand.Parameters.Add(New SqlParameter("@Other", Data.SqlDbType.NVarChar))

myCommand.Parameters("@Other").Value = tbUPOther.Text

myCommand.Parameters.Add(New SqlParameter("@PAQuote", Data.SqlDbType.NVarChar))

myCommand.Parameters("@PAQuote").Value = tbUPPAQuote.Text

myCommand.Parameters.Add(New SqlParameter("@TitleFee", Data.SqlDbType.NVarChar))

myCommand.Parameters("@TitleFee").Value = tbUPTitle.Text

myCommand.Parameters.Add(New SqlParameter("@DownPay", Data.SqlDbType.NVarChar))

myCommand.Parameters("@DownPay").Value = tbUPDownPay.Text

myCommand.Parameters.Add(New SqlParameter("@Total", Data.SqlDbType.NVarChar))

myCommand.Parameters("@Total").Value = LBLUTOTAL.Text

myCommand.Connection.Open()

Try

myCommand.ExecuteNonQuery()

ShowMessageBox(Me, "ATTENTION: Customer Data has been Updated.")

bUpdateSlsNum.Enabled = False

Catch ex As SqlException

If ex.Number = 2627 Then

ShowMessageBox(Me, "ERROR: A record already exists with " _

& "the same primary key")

Else

ShowMessageBox(Me, "ERROR: Could not add record")

End If

End Try

myCommand.Connection.Close()

MVMain.ActiveViewIndex = -1

End Sub

View 6 Replies View Related

Updating SQL Database

Feb 9, 2008

Hi,

I have designed a Contacts application, where I store all the Contacts in a SQL Database.

Now, I am deploying this application using Visual Studio 2005 Setup and Deployment project.


I might need the update the database with additional Columns etc at a later stage.

How, can I update the SQL Database after it has been deployed on a client computer?


Please assist

Thanks

View 8 Replies View Related

App_Data Database Not Updating.

Mar 21, 2007

This is a weird problem. I added a database to the app_data folder, but when I make updates and then run some reports the updates aren't shown. The database is updated, cause queries show the updates and I inspected the database. The updates however, aren't being reflected when I run the reports.

View 5 Replies View Related

Problems Updating Database

Mar 26, 2007

I have a web project created with VS2005 that is connected to a database on an SQL Server.  I've created a data diagram on the SQL Server and created a matching dataset in my project.  The data diagram has the 'enforce relationship...' and cascade textboxes checked for the table relationships.  My dataset has 'both relation and foreign key constraint' checked with the rules all set to cascade.  The code creates a table adapter then does the tableadapter.Update.  The data gets added to my main table, but not to any of the child tables.  Any ideas on what could be causing this?
Thanks,Rhonda 

View 4 Replies View Related

Updating Site/Database Once It Is Already In Use

Mar 28, 2007

I am wondering how some of you update your database once it is already been in use.  So take for example you have a few tables and users can enter data into the site.  Now suppose you either add tables to the db or you add fields to an existing table.  I am using sql express 2005 and just want to copy the db over with the copy website but it would overwrite any data users entered.Is there any easy solutions or suggestions for this.Thanks 

View 1 Replies View Related

Updating SQL Database - Using DataTable

Jan 8, 2008

I am quite new to ASP.net 2.0. I have had plenty of experience using ADO.net in standard windows applications.
In my app I am opening a connection to an SQL database and I am creating a DataTable without a DataSet:
Shared m_cnADONetConnection As New System.Data.SqlClient.SqlConnection
Shared m_daDataAdapter As System.Data.SqlClient.SqlDataAdapter
Shared m_rowPosition As Integer
Shared m_dtContacts As New System.Data.DataTable
I am initializing everything and filling my DataTable when the Page first Loads if it isnt a postback.Protected Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Form1.Load
If Not Page.IsPostBack Then
m_rowPosition = 0
m_cnADONetConnection.ConnectionString = "Data Source=.SQLEXPRESS;AttachDbFilename=C:First ASP DatabaseApp_DataMyFirstDatabase.mdf;Integrated Security=True;Connect Timeout=30;User Instance=True"
m_cnADONetConnection.Open()m_daDataAdapter = New System.Data.SqlClient.SqlDataAdapter("Select * From Books", m_cnADONetConnection)m_cbRefillCommand = New System.Data.SqlClient.SqlCommand
m_daDataAdapter.Fill(m_dtContacts)
Me.ShowCurrentRecord()
End IfEnd Sub
The Me.ShowCurrentRecord Sub assigns the values of the current record(row) in the DataTable via (m_rowPosition) to TextBox controls on the form:
I also have record navigation buttons on my form: << < > >> Moving me from record to record (row to row) by incrementing or decrementing m_rowPosition
All is good! I am able navigate the DataTable and the textboxes change their text properties accordingly from record to record.
The only other control on my form is a button which I'm coding its click event to save changes that I made to the current row (record) by changing the values in the textboxes then clicking save.
 Here is my code:Protected Sub ButtonSave_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles ButtonSave.Click
If m_dtContacts.Rows.Count <> 0 Then
m_dtContacts.Rows(m_rowPosition).BeginEdit()m_dtContacts.Rows(m_rowPosition)("Title") = TBTitle.Text
m_dtContacts.Rows(m_rowPosition)("Author") = TBAuthor.Textm_dtContacts.Rows(m_rowPosition)("YearPublished") = TBYearPublished.Text
m_dtContacts.Rows(m_rowPosition)("Price") = TBPrice.Textm_dtContacts.Rows(m_rowPosition)("LastReadOn") = TBLastReadOn.Textm_dtContacts.Rows(m_rowPosition)("PageCount") = TBPageCount.Text
m_dtContacts.Rows(m_rowPosition).AcceptChanges()
m_dtContacts.Rows(m_rowPosition).EndEdit()
m_dtContacts.AcceptChanges()
m_daDataAdapter.Update(m_dtContacts)
End Sub
After I click save I can navigate through my records and back to the one I just changed and updated and all is well. The changes were made in the table.
However, when I close the page and exit out of Visual Web Developer and reopen the database: THE CHANGES WERENT UPDATED!!!
 This worked all the time in VB2005.net when developing a standard windows app.
Can I use the same approach I was using in my code above or am I missing something. 
 
I have read and searched all over and what I'm thinking is that my UpdateCommand, InsertCommand, DeleteCommand, SelectCommand are empty.
Do I have to do it this way?
 
 
 
 
 
 
 

View 1 Replies View Related

Urgent !! Updating DataBase

Jan 19, 2004

Hello all
Can any one help me in updateing the dataBase with the updated datset through the DataGrid
i am able to get the updated dataset from the data Grid but i dont know how to update the database with that
kindly help

View 1 Replies View Related

Error When Updating Database

Oct 28, 2004

Hi all,
I'm getting an error when updating my database. The connection is fine and the dropdown menu is good also so i think it's the way i've formed my sql string. Here's the line i think i'm having probs with:


SQLString = "UPDATE project_descriptions SET " & _
"lecturer_name = '" & Replace(LecturerName.Text,"'","''") & "'," & _
"project_title = '" & Replace(ProjectTitle.Text,"'","''") & "', " & _
"Project_description = '" & Replace(ProjectDescription.Text,"'","''") & "'," & _
" WHERE project_code = '" & ProjectCode.SelectedItem.Value & "'"


Can anyone rearrange it so i stop getting an error?

Here's my code. if it helps.


<%@ Import Namespace="System.Data.OleDb" %>

<SCRIPT language="VB" runat="server">

Dim DBConnection As OleDbConnection
Dim DBCommand As OleDbCommand
Dim DBReader As OleDbDataReader
Dim SQLString As String

Sub Page_Load

If Not Page.IsPostBack Then

'-- Load drop-down list with item numbers
DBConnection = New OleDbConnection("Provider=Microsoft.Jet.OleDb.4.0;Data Source=C:finalyearproject2projectallocation.mdb")
DBConnection.Open()
SQLString = "SELECT project_code FROM project_descriptions ORDER BY project_code"
DBCommand = New OleDbCommand(SQLString, DBConnection)
DBReader = DBCommand.ExecuteReader()
ProjectCode.DataSource = DBReader
ProjectCode.DataTextField = "project_code"
ProjectCode.DataValueField = "project_code"
ProjectCode.DataBind()
DBReader.Close()
DBConnection.Close()


End If

End Sub

Sub SelectRecord (Src As Object, Args As EventArgs)

DBConnection = New OleDbConnection("Provider=Microsoft.Jet.OleDb.4.0;Data Source=C:finalyearproject2projectallocation.mdb")
DBConnection.Open()
SQLString = "SELECT * FROM project_descriptions WHERE " & _
"project_code = '" & ProjectCode.SelectedItem.Value & "'"
DBCommand = New OleDbCommand(SQLString, DBConnection)
DBReader = DBCommand.ExecuteReader()
DBReader.Read()
LecturerName.Text = DBReader("lecturer_name")
ProjectTitle.Text = DBReader("project_title")
ProjectDescription.Text = DBReader("project_description")
DBReader.Close()
DBConnection.Close()
UpdateButton.Visible = True

End Sub


Sub UpdateRecord (Src As Object, Args As EventArgs)

'-- CHECK FOR VALID RECORD ---
Dim ValidRecord As Boolean = True

'-- Check for missing Project Title
If ProjectTitle.Text = "" Then
ProjectTitleMessage.Text = "Missing Project Title"
ValidRecord = False
End If

'-- Check for missing Lecturer Name
If LecturerName.Text = "" Then
LecturerNameMessage.Text = "Missing Lecturer Name"
ValidRecord = False
End If

'-- Check for missing Project Description
If ProjectDescription.Text = "" Then
ProjectDescriptionMessage.Text = "Missing Project Description"
ValidRecord = False
End If




If ValidRecord = True Then

'-- UPDATE A RECORD --
Try
DBConnection = New OleDbConnection("Provider=Microsoft.Jet.OleDb.4.0;Data Source=C:finalyearproject2projectallocation.mdb")
DBConnection.Open()


SQLString = "UPDATE project_descriptions SET " "lecturer_name = '" & Replace(LecturerName.Text,"'","''") & "'," "project_title = '" & Replace(ProjectTitle.Text,"'","''") & "', " "Project_description = '" & Replace(ProjectDescription.Text,"'","''") & "'," " WHERE project_code = '" & ProjectCode.SelectedItem.Value & "'"
DBCommand = New OleDbCommand(SQLString, DBConnection)
DBCommand.ExecuteNonQuery
DBConnection.Close()
UpdateMessage.Text = "Record updated"
Catch
UpdateMessage.Text = "Update problem. Record not changed. " & SQLString
End Try

End If

End Sub


</SCRIPT>

<html>
<head>


<style>
.head {font-family:arial; font-size:12pt; font-weight:bold; width:560px;
border:outset 1 #F0F0F0; padding:2pt; background-color:#990000;
color:#FFFFFF; text-align:center}
.box {font-family:arial; font-size:8pt; line-height:9pt; width:200px;
height:20px; overflow:auto}
.right {text-align:right}
.center {text-align:center}
table {font-family:arial; font-size:8pt; line-height:9pt; width:560px;
background-color:#F9F9F9; border-collapse:collapse}
th {font-family:arial; font-size:8pt; line-height:14pt;
font-weight:bold; text-align:center; vertical-align:bottom;
background-color:#990000; color:#FFFFFF}
td {font-family:arial; font-size:8pt; line-height:9pt;
vertical-align:top}
</style>
</head>

<body>
<form runat="server">

<div class="head">Project Update</div>

<table id="UpdateTable" border="1" rules="rows">
<tr>
<th> Project Code: </th>
<td><asp:DropDownList id="ProjectCode" runat="server"/>
<asp:Button Text="Select" OnClick="SelectRecord" runat="server"/>
</td>
<td></td>
</tr>
<tr>
<th> Lecturer Name: </th>
<td><asp:TextBox id="LecturerName" runat="server"
Columns="40"
MaxLength="50"/></td>
<td><asp:Label id="LecturerNameMessage" runat="server"
ForeColor="#FF0000"
EnableViewState="False"/></td>
</tr>

<tr>
<th> Project Title: </th>
<td><asp:TextBox id="ProjectTitle" runat="server"
Columns="40"
MaxLength="50"/></td>
<td><asp:Label id="ProjectTitleMessage" runat="server"
ForeColor="#FF0000"
EnableViewState="False"/></td>
</tr>

<tr>
<th> Project Description: </th>
<td><asp:TextBox id="ProjectDescription" runat="server"
TextMode="MultiLine"
Columns="45"
rows="3"/></td>
<td><asp:Label id="ProjectDescriptionMessage" runat="server"
ForeColor="#FF0000"
EnableViewState="False"/></td>
</tr>

</asp:Panel>

</table>
<br>
<asp:Button id="UpdateButton" runat="server"
Text="Update Record"
Visible="False"
OnClick="UpdateRecord"/>
<asp:Label id="UpdateMessage" runat="server"
ForeColor="#FF0000"
EnableViewState="False"/>
</form>
</body>
</html>

View 4 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved