DataSource Controls :: IsDBNull Is Not Working?

Apr 28, 2010

In codebehind I've succesfully connected to a TableAdapter, sent a parameter value, and am looping through the results of the selected record.Some of the values in the returned row, however, are nulls.Why won't this work?

[Code]....

I get The value for column 'AutoAGENTID' in table 'Permits' is DBNull.

View 5 Replies


Similar Messages:

DataSource Controls :: What's Faster Working With DataSet OR Working With Collections (LINQ To Entities)

May 21, 2010

I mean, what is the faster way to get as fast as I can more than one table with stored procedure? Is there any study what is faster and why? There is a big problem getting more than one table at once with Entities, so the only way is DataSet. But I was told DataSet work very slow. Is that true?

View 2 Replies

DataSource Controls :: Entity FK Setup Via VS2010 / Working Enity Model With Foreign Keys Working?

Jul 9, 2010

Am trying to get a working enity model with foreign keys working but have run into a problem. I have imported 3 tables with content and some data.Lets call these tables geo_countries, geo_counties, geo_municipalities and the FK are:1. geo_county have a column country_id wich corresponds to country_id in geo_country 2. geo_municipality have a column county_id wich correspond to the county_id in geo_county.The problem i have is when i try to get correspondig child items with the following code i run into trouble:

[Code]....

The problem above is that 'test' generates results but not 'test2', wich never return anything. Am i not supposed to be able to do it like i do in 'test2'? I earlier tried to add a child object by replacing ToList() with Add() and that worked. But i cant seem to get anything out of it.

View 4 Replies

DataSource Controls :: SQL Datasource Commands Not Working On Hosted Pages?

Dec 1, 2010

im explaining this base on a test page that i have hosted as i was trying to track down my problem, i have a hosted page which i have hosted on the internet on a hosting service provider. the page has a normal gridview that is linked to a SqlDataSource. and theSqlDataSource has sql statements for selecting data, updating and deleting. They all work fine locally and even if i host them locally through IIS. but on the hosting service they down work. only the select work, which means i can view my data on the gridview but i cant manipulate it, delete and updating dont wanna work, they dont do anything. and the worse part is that im not even getting an error from them, on the grid i have enabled the autogenerate edit button and the delete, how can i make the update and delete work, or what is it that makes them not to work. the code for my test page is below

[Code]....

View 2 Replies

DataSource Controls :: SQL Insert Not Working?

Feb 27, 2010

I have the following code:

[Code]....

but when I run it inserts '@test' (no quotes) into the database. What am I doing wrong? It's probably really simple but I've been looking at it for ages! :(

View 2 Replies

DataSource Controls :: Sql Queryy Is Not Working?

May 4, 2010

i.I have a problem with a sql query?there is 2 table.Student and file.Student uploads a file into database.Student FileStuID FileIDName FileNameSurname FileSize StuIDi wannt to show student's information and his uploaded files.For example:

View 13 Replies

DataSource Controls :: Stored Proc Is Not Working?

Mar 18, 2010

I have made a simple stored proc which include Transaction through which I have to delete records from two tables EmpDetail and EmpDept . EmployeeId is PK in EmpDetail and FK in EmpDept. Procedure has been executed but on doing exec DelEmployee @EmployeeID='e07' showing 0 rows affected..

[Code]....

View 6 Replies

DataSource Controls :: Datatable Sorting Not Working

Apr 13, 2010

Dim dt as datatable = test.select()
dt.DefaultView.Sort = "col1 ASC"
for each dr in dt.rows
response.write(dr.item("col1"))
next

I had found out the sorting command is "dt.DefaultView.Sort", but why is it not working. Can someone shed a light.

View 3 Replies

DataSource Controls :: E.Cancel Not Working In SqlDataSource1_Selecting(..)

Feb 23, 2010

I have DropDownList and GridView on my page. GridView is popuated based on DropDownList SelectedValue.

DropDownList Populated as following
DropDownList looks like (after binding)

View 3 Replies

DataSource Controls :: DataTable With DataReader Not Working?

May 17, 2010

dataTable with dataReader not working

[Code]....

View 3 Replies

DataSource Controls :: ConflictDetection In ObjectDataSource Is Not Working?

Mar 10, 2010

I am trying to update record in GridView. But ObjectDataSource is creating original_{0} and new vlaue object (exactly the same).ObjectDataSource.UpdateMethod is as follows

[Code]....

The paremeters ("original_ProductBO" and "productBO") in the above function are supposed to have different values since I am editing record in GridView and then updating it.I have the checked the query by hard coding parameter values and it works. In the ObjectDataSource_Updating(..) event, I cheked the parameters ("original_ProductBO" and "productBO") , I am getting the same values. Can anyone tell why tow parameters have the same values when I am editing record in GridView Code for the ObjectDataSourec and GridView is attached below

[Code]....

[Code]....

View 3 Replies

DataSource Controls :: LINQ To SQL SubmitChanges() Not Working Sometimes?

Oct 30, 2010

I was trying to delete records from database and sometimes on production, the SubmitChanges() goes through and updates the associated entities yet the data does not gets deleted in the database.This is happening only in production and I could not replicate the same on stage or on my local machine. Now the table in which I am performing the delete transaction does have primary keys.

My code reads like

[Transactional(TransactionalTypes.TransactionScope)]

View 2 Replies

DataSource Controls :: Update Record Not Working?

Jun 17, 2010

I am not sure if I am in the right spot here because this really doesn't have to do any datacontrol but hopefully somone can give me a hand with this.

Basically I have a bunch of TextBox controls on a page that are displaying the data I want but when I try to run an UPDATE query on the record I get nothing. The record values don't update and I don't appear to get any exceptions.....I am actually kinda really baffled on this one, here is what I have for the update code: [Code]....

Btw, if there is an easier way to do this with a control I am up for suggestions as I am just going off of some of my old VB6 ways

View 20 Replies

DataSource Controls :: SqlDataSource Query Not Working?

Feb 18, 2011

I have a strange problem...I am programatically adding an SQL SELECT query to my SqlDataSource that my GridView is bound to. If I use the follwing statement it works fine:

[Code]....

But if I use the following one, the gridview fails to load. The only way that this is different is it uses RTRIM and CAST on one of the fields:

[Code]....

I don't understand why this can be. If I try the statement exactly how it is in the query builder and run it it returns the rows no problem.

View 2 Replies

DataSource Controls :: Update Command Is Not Working?

Jan 17, 2010

given below is the simple update string am using to update my database...

string q = "update register set fname='" + TextBox1.Text +
"',lname='" + TextBox2.Text +
"',gender='" + gender +
"',edu='" + TextBox3.Text +
"' where username='"+check +"'";
cmd.ExecuteNonQuery();
SqlCommand cmd =
new
SqlCommand(q, cn);

but it is not working...database is not getting updated...why?

View 2 Replies

DataSource Controls :: QueryString Parameter Not Working?

Jun 29, 2010

this has to be a simple thing but I am missing it

here's what i have

the null condition and query works

the not null condition does not

I have tried:

ImageID=@id error myust declare @id
ImageID=id invalid column id
ImageID=?id incorrect syntax at ?
all errors occur at SqlDataReader Dr = Cmd.ExecuteReader();
int id = Convert.ToInt32(Request.QueryString["id"]);
string SQLquery ="";
if (id == null)
{
SQLquery = "Select Top 1 ImageData,ImageType from WebBGImages ORDER BY NEWID()";
}
else
{
SQLquery = "Select ImageData,ImageType from WebBGImages where ImageID=@id";
}
SqlCommand Cmd = new SqlCommand(SQLquery, connection);
SqlDataReader Dr = Cmd.ExecuteReader();

View 1 Replies

DataSource Controls :: SqlDataSource CommandTimeout Not Working?

Jan 20, 2010

I'm using the CommandTimeout command on a SqlDataSource in a web page to allow running queries that will take longer than 30 seconds.However, when I run the web page, it doesn't work at all. I get a timeout error.Here is my code:

[Code]....

[Code]....

And the error I'm getting after 30 seconds: Exception Details: System.Data.SqlClient.SqlException: Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding.

View 2 Replies

DataSource Controls :: Batchupdate Is Not Working For Dataadapter?

Feb 10, 2010

Im trying to do the batchinsert (bulk) in sqldataadapter using dataset.but somehow its not inserting (even no error as well), i dunno where i went wrong.my coding..

Dim _cmd As New SqlCommand

View 6 Replies

DataSource Controls :: Update Table Not Working?

Jun 3, 2010

I have a sproc that updates data in the table but I'm having difilulties with one of the params that is of type datetime. In the sproc, a decision is made based on this date such as if the date is null/blank/emplty, update data, else delete data. I've tried things like

if(@Date_returned IS NOT NULL)

if(NOT @Date_returned = '')

if(@Date_returned = '')

if(@Date_returned > '01/01/0001')

but it always defaults to the "else" part where it deletes my data. The date is passed to the sproc from a .net calendar form object via a bll/dal and I can track the variable with its value. When I actually pick a date it has the date I've picked, otherwise it has a devault value of "01/01/0001 ....".

How should ckeck for this condition?

View 4 Replies

DataSource Controls :: DataReader.Read() Not Working?

Mar 16, 2010

I have used SqlDataReaders a million times. Someone, what is wrong with this code:

SqlConnection connection = new SqlConnection(connectionString);
try
{
connection.Open();
SqlCommand command = connection.CreateCommand();

[Code]....

I have checked this against similar classes and it is exactly the same, but this one doesn't work.

View 4 Replies

DataSource Controls :: How To Update Command Not Working Properly

Jun 25, 2010

I have the below code in my project..however its giving me an error on the update(bolded line)..please help me on this..

Private Sub ChangePassword1_ChangedPassword(ByVal sender As Object, ByVal e As System.EventArgs) Handles ChangePassword1.ChangedPassword
lblTempPassword.Text = ChangePassword1.NewPassword.ToString
CustomerName.Text = CType(Session("UserName"), String)
Dim FV1Updobjconn As Data.SqlClient.SqlConnection
FV1Updobjconn = New Data.SqlClient.SqlConnection()
FV1Updobjconn.ConnectionString = ConfigurationManager.ConnectionStrings("ASPNETDBconnectionString1").ConnectionString
FV1Updobjconn.Open()
Dim dtUpdating As New Data.DataTable()
Dim sqlUpdating As String = "UPDATE [SuperAdmin] SET [TempPasswd]= @SU2TempPasswd, [TempPwd]=@CU2TempPwd WHERE ([CustomerName] = [@CU2CustomerName])"
Dim cmdUpdating As New Data.SqlClient.SqlCommand(sqlUpdating, FV1Updobjconn)
cmdUpdating.Parameters.AddWithValue("@SU2UserId", UserIDValue.Text)
cmdUpdating.Parameters.AddWithValue("@SU2TempPasswd", lblTempPassword.Text)
cmdUpdating.Parameters.AddWithValue("@CU2TempPwd", False)
cmdUpdating.ExecuteNonQuery().... I get an error here saying..INVALID COLUMN "CU2CustomerName"
' Dim adUpdating As New Data.SqlClient.SqlDataAdapter(cmdUpdating)
' adUpdating.Fill(dtUpdating)
' Get the values needed to be passed on
' CtSUCompanyName.Text = dtUpdating.Rows(0)("CompanyName").ToString()
' CtSUCatPurch.Text = dtUpdating.Rows(0)("CategoriesPurchases").ToString()
FV1Updobjconn.Close()
End Sub

View 6 Replies

DataSource Controls :: Sql Server Update Password Not Working

Jun 4, 2010

The users of my webapplication are validated using database connection. This requires each user is a sql server database user. While logging their validity is checking by trying to create a connection using userid and password entered by the user. If connection opens successfully, it is a valid user. I also have a page in application to change the password, where sp_password is used to updated database password.

string connectionString = ConfigurationManager.AppSettings["DBServerName"];
//try to create a new connection dynamically using user id and password
connectionString = connectionString + User ID=" + userId + ";Password=" + password;
using (SqlConnection connection = new SqlConnection(connectionString))
{
connection.Open();
}

The problem is after i change password, and logout and try to login, i am able to login using old passwd also. The line of code which creates and open connection succeeds with both old and new password. If i stop and run the application again this works.

View 5 Replies

DataSource Controls :: Removing Whitespace In String Not Working?

Jan 20, 2010

I am accumulating a string for a SQL IN clause, so the format needs to be WHERE var IN ('string1','string2','string3',etc)

The strings are coming from a multiline textbox where they are pasted in from the user (one per line).

For some reason, I always get a space right after the tick and before the value in every value after the first. For instance my DataReader is only returning one record because the input string turns out like this:

SELECT * FROM Table
WHERE ID IN ('12345',' 23456',' 34567')

Here is how I am processing the string, and I can't see why it is not taking that space out.

[Code]....

Even if I move the replace space (line 2) to the end of the code block, it still wont trim it out...

View 3 Replies

DataSource Controls :: Insert In Stored Procedure Not Working?

May 18, 2010

i am using modalpopupextender and a listviewWhen the user click on an item in the listview it call a modalpopupextender.In that modalpopupextender there are 2 dropwn fill with datasource.When i click the ok button it call a stored procedure with 3 parameter.Nothing happen if i pass the dropdown SelectedItem.Value to the parameter but if i use a static variable the insert will work i don't know what i am missing.

View 3 Replies

DataSource Controls :: Update Method In ObjectDataSource Is Not Working?

Mar 9, 2010

Here is the "Update" method which is not updating.

It works if I remove "@original_UnitPrice" and "@original_OnHand" parameters from the "WHERE" clause.

[Code]....

View 2 Replies







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