Showing posts with label form. Show all posts
Showing posts with label form. Show all posts

Tuesday, March 20, 2012

Added a column to my SQL database and now text field will not write to it. Why

I have a web form that is an interface for a database. The code was working fine until a field needed to be added. So I added the new field, updated the data adapter and data set, and when i enter the data into the field, all of the old fields are getting updated, but the new ones aren't. I am at wits end as to why. Can someone please help!!!

I am using VS Studio 2000 ASP.NET and C#. The code is below. The bold items are the new fields.

using System;

using System.Collections;

using System.ComponentModel;

using System.Data;

using System.Drawing;

using System.Web;

using System.Web.SessionState;

using System.Web.UI;

using System.Web.UI.WebControls;

using System.Web.UI.HtmlControls;

namespace TrafficDept

{

///<summary>

/// Summary description for AddOwner.

///</summary>

publicclass AddOwner : System.Web.UI.Page

{

protected System.Web.UI.WebControls.Button Button1;

protected System.Web.UI.WebControls.RequiredFieldValidator RequiredFieldValidator3;

protected System.Data.SqlClient.SqlConnection sqlConnection1;

protected System.Web.UI.WebControls.TextBox TextBox1;

protected System.Web.UI.WebControls.TextBox TextBox2;

protected System.Data.SqlClient.SqlDataAdapter daAddOwner;

protected System.Web.UI.WebControls.TextBox tbOtherOwnerLName;

protected System.Web.UI.WebControls.Panel namePanel;

protected System.Web.UI.WebControls.TextBox tbOtherOwnerMI;

protected System.Web.UI.WebControls.TextBox tbOtherOwnerFName;

protected System.Web.UI.WebControls.TextBox tbSecondOwnerLName;

protected System.Web.UI.WebControls.TextBox tbSecondOwnerMI;

protected System.Web.UI.WebControls.TextBox tbSecondOwnerFName;

protected System.Web.UI.WebControls.Button Button4;

protected SiteCubed.EditWorksProfessional tbNote;

protected System.Web.UI.WebControls.Panel notePanel;

protected System.Web.UI.WebControls.DropDownList ddlStatus;

protected PeterBlum.PetersDatePackage.DateTextBox tbRegDate;

protected System.Web.UI.WebControls.RequiredFieldValidator RequiredFieldValidator2;

protected System.Web.UI.WebControls.TextBox tbOwner;

protected System.Web.UI.WebControls.RequiredFieldValidator RequiredFieldValidator1;

protected System.Web.UI.WebControls.TextBox tbOwnerMI;

protected System.Web.UI.WebControls.TextBox tbOwnerLName;

protected System.Web.UI.WebControls.RequiredFieldValidator RequiredFieldValidator4;

protected System.Web.UI.WebControls.TextBox tbBusinessName;

protected System.Web.UI.WebControls.TextBox tbAddress;

protected System.Web.UI.WebControls.TextBox tbRegNo;

protected System.Web.UI.WebControls.TextBox tbPreviousOwner;

protected System.Web.UI.WebControls.TextBox tbPOwnerAddress;

protected System.Web.UI.WebControls.TextBox tbPORegNo;

protected PeterBlum.PetersDatePackage.DateTextBox tbTransferDate;

protected System.Web.UI.WebControls.DropDownList ddlMeans;

protected System.Web.UI.WebControls.Button Button3;

protected System.Web.UI.WebControls.Button Button2;

protected System.Data.SqlClient.SqlCommand sqlSelectCommand1;

protected System.Data.SqlClient.SqlCommand sqlInsertCommand1;

protected System.Data.SqlClient.SqlCommand sqlUpdateCommand1;

protected System.Data.SqlClient.SqlCommand sqlDeleteCommand1;

protected TrafficDept.dsAddOwner dsAddOwner1;

privatevoid Page_Load(object sender, System.EventArgs e)

{

// Put user code to initialize the page here

}

#region Web Form Designer generated code

privatevoid Button2_Click(object sender, System.EventArgs e)

{

Response.Redirect("AddOthers.aspx");

}

privatevoid Button1_Click(object sender, System.EventArgs e)

{

daAddOwner.Fill(dsAddOwner1);

dsAddOwner.OwnershipRow drOwner = dsAddOwner1.Ownership.NewOwnershipRow();

drOwner.Plates_ID =int.Parse(Session["PlatesID"].ToString());

drOwner.Status = ddlStatus.SelectedItem.Text;

drOwner.Current_Legal_Owner = tbOwner.Text;

drOwner.Owner_CurrentLegalOwnerMI = tbOwnerMI.Text.ToString();

drOwner.Owner_CurrentLegalOwnerLName = tbOwnerLName.Text;

drOwner.Owner_CurrentBusinessName = tbBusinessName.Text;

if (!tbRegDate.xIsEmpty)

drOwner.Date_of_Registration = DateTime.Parse(tbRegDate.Text.ToString());

drOwner.Address_of_Current_Owner = tbAddress.Text;

drOwner.Reg_No_for_Current_Owner = tbRegNo.Text;

drOwner.Previous_Owner = tbPreviousOwner.Text;

drOwner.Previous_Owner_Address = tbPOwnerAddress.Text;

drOwner.Reg_No_for_Previous_Owner = tbPORegNo.Text;

if (!tbTransferDate.xIsEmpty)

drOwner.Date_of_Transfer = DateTime.Parse(tbTransferDate.Text.ToString());

drOwner.By_Means_of = ddlMeans.SelectedItem.Text;

drOwner.Owner_SecondaryLegalOwnerFName = tbSecondOwnerFName.Text;

drOwner.Owner_SecondaryLegalOwnerMI = tbSecondOwnerMI.Text;

drOwner.Owner_SecondaryLegalOwnerLName = tbSecondOwnerLName.Text;

drOwner.Owner_OtherLegalOwnerFName = tbOtherOwnerFName.Text;

drOwner.Owner_OtherLegalOwnerMI = tbOtherOwnerMI.Text;

drOwner.Owner_OtherLegalOwnerLName = tbOtherOwnerLName.Text;

drOwner.Owner_Notes = tbNote.Text;

dsAddOwner1.Ownership.Rows.Add(drOwner);

daAddOwner.Update(dsAddOwner1);

Response.Redirect("AddOthersTP.aspx");

}

privatevoid Button3_Click(object sender, System.EventArgs e)

{

//daAddOwner.Fill(dsAddOwner1);

//dsAddOwner.OwnershipRow drAddOwner = dsAddOwner1.Ownership.NewOwnershipRow();

namePanel.Visible =true;

}

privatevoid Button4_Click(object sender, System.EventArgs e)

{

notePanel.Visible =true;

}

}

}

I found my problem. The .dll was never being rebuilt.

add with null

I have two int fields of a table: Count1 and Count2
I select with the sql:
Select Count1+Count2 as CountSum form myTable
When one filed have a value and the other with null, the CountSum will be
null.
I wnat to treate the null value as 0 int, So I want to 2+ null=2
How can I do?ad wrote:
> I have two int fields of a table: Count1 and Count2
> I select with the sql:
> Select Count1+Count2 as CountSum form myTable
>
> When one filed have a value and the other with null, the CountSum will be
> null.
> I wnat to treate the null value as 0 int, So I want to 2+ null=2
> How can I do?
>
SELECT COALESCE(Count1, 0) + COALESCE(Count2, 0)
Tracy McKibben
MCDBA
http://www.realsqlguy.com

add with null

I have two int fields of a table: Count1 and Count2
I select with the sql:
Select Count1+Count2 as CountSum form myTable
When one filed have a value and the other with null, the CountSum will be
null.
I wnat to treate the null value as 0 int, So I want to 2+ null=2
How can I do?ad wrote:
> I have two int fields of a table: Count1 and Count2
> I select with the sql:
> Select Count1+Count2 as CountSum form myTable
>
> When one filed have a value and the other with null, the CountSum will be
> null.
> I wnat to treate the null value as 0 int, So I want to 2+ null=2
> How can I do?
>
SELECT COALESCE(Count1, 0) + COALESCE(Count2, 0)
Tracy McKibben
MCDBA
http://www.realsqlguy.com

Monday, March 19, 2012

add user to stand by database

I have one db which i restore form other db server in standby mode. Now user
exist on the new server but they r not mapped to the standby db.
How can i assign the user to standby dbsp_help_revlogin will resolve you problem - remap logins
read "How to transfer logins and passwords between instances of SQL Server"
at http://support.microsoft.com/kb/246133
--
Aleksandar Grbic
MCDBA, Senior Database Administrator
"VSS" wrote:
> I have one db which i restore form other db server in standby mode. Now user
> exist on the new server but they r not mapped to the standby db.
> How can i assign the user to standby db
>
>|||Hi,
You can create DTS package which will import users from one server to another
Amol Lembhe
"Aleksandar Grbic" wrote:
> sp_help_revlogin will resolve you problem - remap logins
> read "How to transfer logins and passwords between instances of SQL Server"
> at http://support.microsoft.com/kb/246133
> --
> Aleksandar Grbic
> MCDBA, Senior Database Administrator
>
> "VSS" wrote:
> > I have one db which i restore form other db server in standby mode. Now user
> > exist on the new server but they r not mapped to the standby db.
> > How can i assign the user to standby db
> >
> >
> >

add user to stand by database

I have one db which i restore form other db server in standby mode. Now user
exist on the new server but they r not mapped to the standby db.
How can i assign the user to standby dbsp_help_revlogin will resolve you problem - remap logins
read "How to transfer logins and passwords between instances of SQL Server"
at http://support.microsoft.com/kb/246133
Aleksandar Grbic
MCDBA, Senior Database Administrator
"VSS" wrote:

> I have one db which i restore form other db server in standby mode. Now us
er
> exist on the new server but they r not mapped to the standby db.
> How can i assign the user to standby db
>
>|||Hi,
You can create DTS package which will import users from one server to anothe
r
Amol Lembhe
"Aleksandar Grbic" wrote:
[vbcol=seagreen]
> sp_help_revlogin will resolve you problem - remap logins
> read "How to transfer logins and passwords between instances of SQL Server
"
> at http://support.microsoft.com/kb/246133
> --
> Aleksandar Grbic
> MCDBA, Senior Database Administrator
>
> "VSS" wrote:
>

Tuesday, March 6, 2012

Add new record

Hallo everyone,
I have a form with unbound textboxes that forms a record,how can I add a
new record of unbound textboxes afterI have update the first record?
Can anyone help me please?
You haven't specified what development environment you are using. This
isn't a SQL Server-specific question so you'll probably get more help
posting to a group for the appropriate tool: Access? VB? C#? ASP?
David Portas
SQL Server MVP

Add new record

Hallo everyone,
I have a form with unbound textboxes that forms a record,how can I add a
new record of unbound textboxes afterI have update the first record?
Can anyone help me please?You haven't specified what development environment you are using. This
isn't a SQL Server-specific question so you'll probably get more help
posting to a group for the appropriate tool: Access? VB? C#? ASP?
--
David Portas
SQL Server MVP
--

Add new record

Hallo everyone,
I have a form with unbound textboxes that forms a record,how can I add a
new record of unbound textboxes afterI have update the first record?
Can anyone help me please?You haven't specified what development environment you are using. This
isn't a SQL Server-specific question so you'll probably get more help
posting to a group for the appropriate tool: Access? VB? C#? ASP?
David Portas
SQL Server MVP
--

Add mode problem on field setup with Foreign Key

Hello,

I have two tables (one-to-many relation) related thru a common key. I have setup the Relation using the Database Designer. The Form is populated using Drag-and-drop which automatically adds the BindingSource, TableAdapter, and Binding Navigator. The Relation works great in the change mode, and life is good.

In the Add mode the field setup with the Foreign Key is not automatically populated as it is in Change mode. The field can be updated manually, but that defeats the purpose of setting up the Relation.

Any ideas how to fix this?

I know this is difficult to visualize without seeing it.

Thank you for any ideas,

Tom

The detail grid (or some other graphic control) should be linked to the relation itself not the underlying detail database table. Master's PK should be FK in Detail.

See here on MSDN2:

One BindingSource is bound to the parent Customers table in the data set. This data is displayed in the master DataGridView control. The other BindingSource is bound to the first data connector. The DataMember property of the second BindingSource is set to the DataRelation name. This causes the associated detail DataGridView control to display the rows of the child Orders table that correspond to the current row in the master DataGridView control.

Saturday, February 25, 2012

Add filters dynamically

Hi,

I am using a ReportViewer control on the windows form to connect to Report Server, process the report remotely (ServerReport) and render the report in PDF format.

The user wants to add some fiter(criteria) each time before the report is rendered. The filter (criteria) is generated separately. The original content of RDL should not be changed. I know, Report Builder is an option available. But, the end-user doesnt want to use Report builder to design the report.

I need to know, is there anyway I can retrieve the dataset->commandtext of the report(published on REport Server), edit and set it back dynamically, before rendering to PDF or any API, which can allow to add filters programmatically.

Thanks in advance.

You can pass it as report parameter. But is must be done carefully to prevent SQL injections)

Add filters dynamically

Hi,

I am using a ReportViewer control on the windows form to connect to Report Server, process the report remotely (ServerReport) and render the report in PDF format.

The user wants to add some fiter(criteria) each time before the report is rendered. The filter (criteria) is generated separately. The original content of RDL should not be changed. I know, Report Builder is an option available. But, the end-user doesnt want to use Report builder to design the report.

I need to know, is there anyway I can retrieve the dataset->commandtext of the report(published on REport Server), edit and set it back dynamically, before rendering to PDF or any API, which can allow to add filters programmatically.

Thanks in advance.

You can pass it as report parameter. But is must be done carefully to prevent SQL injections)

Sunday, February 19, 2012

add an image to the web page

hi

u didnot get the question!

I asked I copeid an image to the app_data folder and dropdowned a image object to the web form, image--> style-->background-->background image-->select back ground image from the app_data folder , the image appear on the page but when I debug the page it donot display

Thats because you posted in the wrong forum, this is a SQL Server Express forum and depending on the rare information you gave, I assumed that you want to load the image from SQL Server and display it in a webpage. If the file is on disk you will have to provide the code you are using to do this. BTW the app_data folder is reserved for storing data not the actual res / misc files.

Jens K. Suessmeyer.

http://www.sqlserver2005.de