Write Data Into Database From A Session?
Oct 8, 2005
I'm trying to write data from a session into database but it won't work.
Could someone help me what is wrong with this.
cobjDT = Session("cart")
For each cobjDR in cobjDT.rows
Dim cmdInsert2 as New SQLCommand("order_details", loConn)
cmdInsert2.CommandType = CommandType.StoredProcedure
cmdInsert2.Parameters.Add(New SqlParameter("@Orders", SqlDbType.int, 4,
"OrderID"))
cmdInsert2.Parameters("@Orders").Value = Request("OrderIDtext")
cmdInsert2.Parameters.Add(New SqlParameter("@PID", SqlDbType.int, 4,
"PID"))
cmdInsert2.Parameters("@PID").Value = Request(cobjDR("PID"))
cmdInsert2.Parameters.Add(New SqlParameter("@PakID", SqlDbType.int, 4,
"PakID"))
cmdInsert2.Parameters("@PakID").Value = Request(cobjDR("PAKID"))
cmdInsert2.Parameters.Add(New SqlParameter("@StyckPris",
SqlDbType.decimal, 9, "StyckPris"))
cmdInsert2.Parameters("@StyckPris").Value = Request(cobjDR("StyckPris"))
cmdInsert2.Parameters.Add(New SqlParameter("@Mangd", SqlDbType.int, 4,
"Mangd"))
cmdInsert2.Parameters("@Mangd").Value = Request(cobjDR("Quantity"))
loConn.Open()
cmdInsert2.ExecuteNonQuery()
loConn.Close()
next
When I execute this an error message comes
Server Error in '/examen' Application.
Input string was not in a correct format.
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.FormatException: Input string was not in a correct format.
Source Error:
Line 78: cmdInsert2.Parameters("@Mangd").Value = Request(cobjDR("Quantity"))Line 79: loConn.Open()Line 80: cmdInsert2.ExecuteNonQuery()Line 81: loConn.Close()Line 82: next
Source File: D:lofa.mine.nuexamenmembersTMP3thkwo1d0w.aspx Line: 80
Stack Trace:
[FormatException: Input string was not in a correct format.] System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream) +723 System.Data.SqlClient.SqlCommand.ExecuteNonQuery() +194 ASP.TMP3thkwo1d0w_aspx.Page_Load(Object Sender, EventArgs E) in D:lofa.mine.nuexamenmembersTMP3thkwo1d0w.aspx:80 System.Web.UI.Control.OnLoad(EventArgs e) +67 System.Web.UI.Control.LoadRecursive() +35 System.Web.UI.Page.ProcessRequestMain() +731
Version Information: Microsoft .NET Framework Version:1.1.4322.573; ASP.NET Version:1.1.4322.573
I use same character types in storedProcedure what they are in the
database and when I call the SP on my page the char types are same as
they are in the SP
I don't see what the problem is. Please Help
View 1 Replies
ADVERTISEMENT
Jan 8, 2006
Each user who inserts a new SQL record from the FormView control needs to have their UserID in one of the fields of the record. I have the user ID stored in the Session("UserID") variable. I am having trouble finding the right way to get this done. I have tried using a hidden text box but I can't seem to assign the value. I have tried the Insert Parameters but that will not accept <%# Session("UserID") %> as a DefaultValue. Any ideas would be helpful. Thanks.
View 5 Replies
View Related
Nov 6, 2007
I'm sure this is a very simple piece of code, but I'm having trouble understanding how to do this.
First I have a database with three columns
ContactID
View 1 Replies
View Related
Aug 3, 2006
The 2.0 version of ASPSTATE is slightly different than the 1.1 version in that one table has one additional column and another table uses a different data type and size for the key. The 2.0 version also has a couple additional stored procedures.
We'd like to manage just one session state database if possible so we're trying to figure out if Microsoft supports using the new schema for 1.1 session state access (it seems to work, but our testing has been very light).
Is there any official support line on this? If not, can anyone comment on whether or not you'd expect it to work and why?
Thanks.
View 1 Replies
View Related
Dec 22, 2003
Dear expert, please show me some examples of how I can update an Microsoft SQL table data with an excel sheet. Meaning, when I upload an excel sheet using an ASPX page the data in the excel sheet will be transfer to a particular table in the database. Thank you in advance.
View 2 Replies
View Related
Jan 13, 2006
I'm new on ASP.NET 2.0Can anyone tell me how to get data from SQL to Session properties?
In Classic ASP, it looks very simple as below.dim connset conn = server.createobject("adodb.recordset")rssql = "select myid, mypw from mydb where myid = '"& request("myid") &"' and mypw = '"& request("mypw") &"'"set rs = conn.execute(rssql)if rs.eof = true thensession("myid") = rs("myid")session("mypw") = rs("mypw")end if
How to do the same things on ASP.NET?Many thanks!
View 6 Replies
View Related
Jul 20, 2005
Hiya!I've combed the SQL Server 2000 online help but I don't see anythingakin to Sybase ASE's 'montor' views - equivalent to Oracle's V$views. The views are performance views which contain per sessioninformation such as:- SPID- number of logical read/write and physical read I/Os accumulatedthus far- CPU accumulated- Memoryetc.Does anyone know if I can snarf that data from SQL Server 2000?Thx!--Pablo Sanchez, Blueoak Database Engineeringhttp://www.blueoakdb.com
View 3 Replies
View Related
Feb 26, 2007
Hi,
I'm using the SQL Datasource control. I want to use a value of a row in a session control parameter.
I have something like this now:
<asp:SessionParameter Name="ArticleType" SessionField="Article_type_" & number_in_gridview />
number_in_gridview
must be filled with a value in the gridview of the current row.
Does anybody how to do this ?
Regards,
Vortex
View 1 Replies
View Related
Jun 12, 2006
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>" SelectCommand="SELECT Quiz.Title, UserQuiz.DateTimeComplete, UserQuiz.Score FROM UserQuiz INNER JOIN Quiz ON UserQuiz.QuizID = Quiz.QuizID WHERE (UserQuiz.UserName = @UserName) ORDER BY UserQuiz.DateTimeComplete"> <SelectParameters> <asp:SessionParameter Name="UserName" SessionField="UserName" /> </SelectParameters> </asp:SqlDataSource>how to modify this code so that it can insert value of the username captured in the session to the database table record?
View 4 Replies
View Related
Jun 29, 2006
Does anyone know of any session management with mysql scripts that uses cjtracking?
View 1 Replies
View Related
Jan 12, 2007
I'm having trouble using session data in my select parameters. If I manually plug a value into the selectcommand or create a hard coded value using a parameter it works, but if I try to use the session data the query pulls no results. I know the session data is set because I print the value at the top of the page, but for some reason it's not getting passed to the sessionparameter???
This is the datasource code:
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:flautoconnstr %>"
SelectCommand="SELECT * FROM [tblVehicles] WHERE ([profileid] = @profileid)">
<SelectParameters>
<asp:SessionParameter Name="profileid" SessionField="profileid" Type="String" />
</SelectParameters>
</asp:SqlDataSource>
This is the line I use to set the session data.
Session["profileid"] = myQuote.Profileid;
View 1 Replies
View Related
Oct 19, 2000
Hi:
I like to know how I may store some user-specific data at the beginning of a session and retrieve the same data later during the session in a SQL command. For those of you familiar with ORACLE, I am trying to mimic the SET_CLIENT_INFO and GET_CLIENT_INFO functions of ORACLE's DBMS_APPLICATION_INFO package on SQL Server.
Any suggestions?
thanks,
Peter
View 1 Replies
View Related
Dec 25, 2006
I downloaded a copy of sql server and when I run the following query in the sql management studio after choosing new query , DMX I get the above error
CREATE MINING MODEL [NBSample]
(
CustomerKey LONG KEY,
Gender TEXT DISCRETE,
[Number Cars Owned] LONG DISCRETE,
[Bike Buyer] LONG DISCRETE PREDICT
)
Using Microsoft_Naive_Bayes
Also in the pane Mining Model I get the message No mining models found. The only error I get when I installed SQL server was a COM plus registration error. I am running Windows XP SP2. Can someone please help.
Vijay Mukhi
HOD Helios
View 1 Replies
View Related
Jul 26, 2004
I am contemplating storing session state data in a SQL server database (created by running the installSqlState.sql script included in the .NET framework installation) and have established a functioning connection to the database but I am constantly getting "access denied". I've found that tweeking the permission settings in SQL for the ASP.NET user is resolving each specific error that arises but was wondering if there is a more "global" resolution? I'm finding myself having to manually check off each individual object and every option or is this what is needed to resolve the "access denied" error?
Thank you.
View 1 Replies
View Related
Nov 10, 2015
I have created a session in extended events and want to frequently monitor the events that i have filtered .The problem i am facing is i am not able to clear the previous data as we do it in SQL trace. i am able to see all the data that is occupied till now.whenever i start the test i want the current data only to be displayed.The work around is either delete the session and create a new one every-time which i do not want to do .I am able to see the CLEAR DATA FROM TABLE button but it is in Disabled state all the time.
View 2 Replies
View Related
Dec 1, 2006
I have a SqlDataSource that has a parameter that I am trying
to set.
The item is stored in a session field called “GameObject�
Game Object is a simple class that has a several variables.
I am trying to access the .name data member of the class.
<asp:SessionParameter Name="GameCode" SessionField="((GamingSystem)Session[‘GameObject’]).Name" />
This does not work. Is there a way to declarative bind to
the item that I am for.
View 3 Replies
View Related
Nov 2, 2007
Hello, I have worked with SQL Server 2000 but now we have a requirement where I need to write values from an asp.net form into an XML type in SQL Server 2005.I have never used XML as a type in SQL Server 2005. How do we write xml into xml type. For example the structure of XML is something like:<application><applicationID = "value"></applicationID><customerName="value></customerName></application>I have to write this kind of XML into the XML type and later retrieve these XML values and populate the form again.Kindly suggest. Thanks a lot.
View 1 Replies
View Related
Jul 23, 2005
Hi,Is there a way to make a database write only, like in SQL server youcan make a DB read only? There is sensitive data which we want dontwant to read.What other alternatives can anyone think?Thanks.
View 4 Replies
View Related
Oct 23, 2006
I am very new to asp.net. I really mainly use PHP but want to migrate to asp.net, but it doesn't seem that easy.I am creating a page for peson to pay a subscription page where they will enter personal information an credit card information.I created the form for this with validation controls.I don't know however how to write the form data to the mssql database.I am using mssql 2005, but i would need a work out for the 2000 version as well.
View 1 Replies
View Related
Jun 26, 2000
Hi
All,
I would like to know write all transcations in the log file to the
database with out doing full backup of the database..
Please let me know is there any dbcc statement or some other method to do this..
Thanks A lot,
VJ
View 1 Replies
View Related
Jan 9, 2008
I have a lot of databases under SQL Server Express 2005, reading an writing datas with VB6 (yes Visual Basic 6) and ADO (Provider SQLOLEDB). I do NOT install the SP2, but yesterday I install Silverlight and now I have SP2 on my SQL Server (9.0.3042) !?
Now I have a strange problem: I can read all datas, but I can't write any data to any tables.
Here a simple example:
I have a table "Professions", one column "RecNo" as int identity (1,1) with primary key and a column "Profession" as nvarchar(30).
Reading like this works:
Dim rcs As New Recordset
sTmp = "select * from Professions order by Profession"
rcs.Open sTmp, gcn, adOpenForwardOnly, adLockReadOnly
If rcs.RecordCount > 0 Then
Do
...
rcs.MoveNext
Loop Until rcs.EOF
End If
rcs.Close
Writing like this doesn't work anymore:
Dim lNewRecNo as long
Dim rcs As New Recordset
sTmp = "select * from Professions where RecNo = 42"
rcs.Open sTmp, gcn, adOpenKeyset, adLockOptimistic
If rcs.RecordCount < 1 Then rcs.AddNew
rcs!Profession = "XYZ"
rcs.Update
lNewRecNo = CNull2Val(rcs!RecNo)
rcs.Close
The rcs-object still give me the new record number after rcs.update, but the record is not in the database table. Adding a record in the Management Studio gives an error "row failed on retrieve on last operation". If I then click the button "Execute SQL" the new record is shown.
Another behaviour: Adding a row in the IDE like described above locks the Management Studio. From where I recieve a time out error then click the button "Execute SQL".
Any ideas whats wrong ?
View 1 Replies
View Related
Sep 6, 2007
This seems about the best place for my query however it does cross over a bit ... dont shoot me.
SQL 2000 sp4 on server 2003
dev env VB6
users XP Sp2
Mdac 2.8
I have a legacy app that required some simple ammendment, insert a single row of data into a simple table (Not rocket Science) Sample : insert into maintcon_mach (maintcon_id, mach_id, date) values (123, 456, getdate())
PK on maintcon_id, mach_id so that single relationship exists between maintcon_id and mach_id in the table.
The procedure above is followed by a verification procedure that checks to see if table maintcon_mach has a mach_id 456 against maintcon_id 123, this procedure returns true. So far so good, however if you step through the procedure till disconnecting from the database and then reconnect and do only the verification again, the data is missing.
The following steps to resolve have resulted in no improvement.
1. Verify MDAC in entire project and on users computers all 2.8
2 Remove transactions (just in case) and still the same.
3 Replace SQL insert with ADO (As below) and still the same.. tried this with and without transactions.
4 Tried referecing older MDACs
5 Installed SQLredist on sample machines and still the same.
rs.Open "maintcon_mach", conMach, adOpenForwardOnly, adLockOptimistic
With rs
.AddNew
!maintcon_id = lngmaint
!mach_id = lngMachID
!Date = Format(Now(), "yyyy-mm-dd")
.Update
End With
Is the problem in SQL or MDAC???
Perhaps I've missed something (Obviously have) but have run out of places to look... Any idea's
In advance ...thanx
View 3 Replies
View Related
Jan 17, 2008
hi all,
I'm working on vb.net 2.0 with clr stored procedures. i've created a project from VB-->Database. there is a stored procedure in my sql server 2005. In the vb project i have to read the stored procedure and write it as xml . and i have to give this writed xml to clr stored procedure.. do any one know the code for this? if so please post here..
View 2 Replies
View Related
Jan 17, 2006
hi, i want to create a form consist of one table of 2 column and 2 row. when i retrive data from the database, how do i wite the data into the tableexample Database retrived datastudent id student name12 nancy22 tracythe table apprence would be like thisc1 r1 value 12c2r1 value nancyc1r2 value 22clr2 value tracyany one help appreaciated
View 3 Replies
View Related
Aug 3, 2007
I need to write data returned by a stored proc to an XML file. The resultant file will then be consumed by an external application. The file has to adhere to a specific schema. Is there a way to do this through SSIS? Is .NET CLR a better option?
View 1 Replies
View Related
Aug 3, 2007
I need to write data returned by a stored proc to an XML file. The resultant file will then be consumed by an external application. The file has to adhere to a specific schema. Is there a way to do this through .NET CLR in SQL Serer 2005? Is SSIS a better option? Thanks.
View 5 Replies
View Related
Dec 20, 2007
I have big problem now, can somebody help me?
I have a program used ASP+SQL2000 ,the connection string is :
strConnection = "Provider=SQLOLEDB;Server=BOUNwindows,1005;User ID=training;Password=training22;Database=ourtraining;"
Everything works fine, I can insert data, delete or modify.
But since we changed sql2000 server to sql 2005 express, then I can read data but can't insert data(write data into sql 2005)
I checked all permission are correct on sql 2005, program are correct, everything looks good, but only can't write data into sql2005
Can somebody help me????
View 5 Replies
View Related
Mar 16, 2006
Hello,
I want to insert a value in a database table during a datareader loop. But I get an error saying that the connection (MyConnection) is already open. This is normal because it is open for processing the datareader loop. But how do I solve this? I just want to write a value for logging the process.
This is my code:
Dim iID as Integer = 1
Dim strSQLNewsLetter As String = "SELECT * FROM Members WHERE Members.Enabled=1"Dim MyCommand=New MySqlCommand(strSQLNewsLetter, MyConnection)MyConnection.Open()Dim myReader as MySQLDataReader myReader = MyCommand.ExecuteReader() While myReader.Read() If MyReader.GetMySqlDateTime(3).ToString() = "0/00/0000 0:00:00" then WriteMyLog(iID, MyReader.GetInt32(0)) End IfEnd While myReader.Close()myConnection.Close()
Function WriteMyLog(iID as Integer, iMemberID as Integer) 'Write Log after Newsletter has been sent Dim strSqlLog as String 'Create query strSqlLog = "INSERT INTO NewsLetterStats (ID, MemberID, TimeSent) VALUES (" strSqlLog &= "" & iID & "," 'NewsLetterID strSqlLog &= "" & iMemberID & "," 'MemberID strSqlLog &= "'" & MySQLTimeStamp() & "')" 'Timestamp Dim MyCmdLogNews As New MySqlCommand(strSqlLog, myConnection) MyCmdLogNews.Connection.Open() MyCmdLogNews.ExecuteNonQuery() MyCmdLogNews.Connection.Close()End Function
View 9 Replies
View Related
Apr 30, 2004
Hi folks,
Do you guys know how to write the Script to update the SQL database? please help me out? For example, the script will update SQL database at 1:00 am every day...some like that?
Thanks,
Vu
View 4 Replies
View Related
Feb 5, 2008
Hello there,How can i take data out of my database, put them into a textbox and then separate with a comma..An example:----------------------------------| column Email || mail1@email.com || mail2@email.com || mail3@email.com |----------------------------------Put them into a textbox and separate with a , (comma)-------------------------------------------------------------------------------------| mail1@email.com, mail2@email.com, mail3@email.com |-------------------------------------------------------------------------------------Anybody who know how I can do that? :S
View 4 Replies
View Related
Dec 4, 2001
Hello All,
Thanks in advance for your help.
I am wondering if there is a correlation between the size of a database and the amount of RAM required in the server. Here's what's going on:
NT4.0 SP 6a, SQL 7.0
2-800 MHz Pentium III Processors
512 MB RAM
Swap Files: two, divided evenly between two partitions, min 512 per partition (dynamic)
3- 9.2 GB Drives, RAID 5
SQL Database size: 2.5 GB
The SQL administrators have a scheduled job set to dump the database every four hours, so they have 6 of these dump files per day. Seagate Backup Exec v 6.? backs up those files every evening. Of course, this is a mission-critical application.
As the NT/Hardware administrator, I was tasked to flash upgrade all the hardware that could be flashed. That happened about three weeks ago. Ever since I flashed it, getting the data dumps has been an inconsistent process. Sometimes it works, sometimes it errors out. The error message is " Lost Delayed - Write Data: The system was attempting to transfer file data from buffers to (path). The write operation failed, and only some to the data may have been written to the file."
On and off during the day, you can't even copy a small file on the server without receiving the same message.
Before I flashed the server, it was blue-screening and needing to be rebooted about once every two weeks. Since I flashed it, the server hasn't been rebooted, because it hasn't blue-screened.
The database dumps are about 2 GB. We were thinking that the way the dump process worked was that a snapshot of the data was put into memory before it was written to disk. We thought since the dump size was larger than Physical Memory + Virtual Memory, that that could be causing the error.
What do you guys think?
1. Is dumping the database first the preferred way to get a backup, or should a backup directly to tape be scheduled instead?
2. Do we have enough RAM for the database?
3. Are there special settings we should set for the RAID controller card to maximize throughput for SQL?
Thanks again. I am definitely not a SQL DBA and any information you can provide would be really helpful.
View 2 Replies
View Related
Sep 10, 2014
I'm trying to write a query to validate the data.
Here is the scenario:
1. The table has Three columns 1.ID, 2.Sqno, 3. Adj
2. The values for adj are (0,1,2)
Case1: The Sqno should start at '001000' for adj in (0,2) and increment by 2, i.e the next sqno would be '001002' and '001004' so on.
Case2: The sqno should start at '001001' for adj in (1) and increment by 2 i.e the next sqno would be '001003' and '001005' so on.
Finally when you do order by sqno and group by ID it will be a running sqno.
ID Sqno Adj
123A 001000 0
123A 001001 1
123A 001002 2
123A 001003 1
123A 001004 2
123A 001005 1
123A 001006 0
123A 001007 1
123A 001008 2
123A 001009 1
write a query that can validate this scenario.
View 2 Replies
View Related
Jul 4, 2007
Dear all,
Do anyone knw that how am I gonna write data from a DB table to TextFiles(.txt)? If use Flat File Destination, how do I do the setting?
View 2 Replies
View Related