473,698 Members | 2,300 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

error for sending(saving) data to database

13 New Member
Hi,
I’m using VS2005 and I’m trying to link the C# windows form to MSSQL. I used BindingNavigato r Control to read the data. After that I add sqlcommand and sqldataadapter to send the data to the database. My code is this

sqlDataAdapter1 .InsertCommand. CommandText =
"INSERT INTO SUDENT (" +
"S_ID, S_NAME, S_ADDRESS, S_PHONE" +
") VALUES ('" +
S_IDComboBox.Te xt + "', '" +
S_NAMETextBox.T ext + "', '" +
S_ADDRESSTextBo x.Text + "', '" +
S_PHONETextBox. Text + "')";

sqlDataAdapter1 .InsertCommand. ExecuteNonQuery ();

It gave me this error
“NulleferenceEx ception was Unhandled” and “ Object refrence not set to an instance of an object” so I add this line

sqlCommand1 = ("INSERT INTO STUDENT (S_ID,S_NAME,S_ ADDRESS,S_PHONE ) VALUES (@S_ID,@S_NAME, @S_ADDRESS,@S_P HONE)" ,sqlConnection1 );

Then it gave me some stupid error. By the way it didn’t make a new object of SqlCommand although I tried ….

So can u help me to solve my problem ? Thank you
Feb 22 '07 #1
3 1143
willakawill
1,646 Top Contributor
Hi. the only object reference I can see in your code is:
sqlDataAdapter1
You could check if this is the correct spelling or if indeed it exists as a valid object.
Feb 22 '07 #2
csharpa
13 New Member
hi thank you for reply.
i correct the spelling but it still gave me the same error.
Feb 23 '07 #3
willakawill
1,646 Top Contributor
hi thank you for reply.
i correct the spelling but it still gave me the same error.
Interesting. You corrected the spelling to what?
Feb 23 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

2
3514
by: UrgeOverkill | last post by:
I'm having a problem sending data from a socket server. The server side reports that it has sent 4845 bytes but the client reports only 1448 bytes received. The kicker is that this ONLY happens accross the internet... I've tested this with multiple connections. If I run the same server and client, connect them locally I don't have a problem with byte totals. Is there a timeout that I need to set... I've looked at and change several...
1
2089
by: | last post by:
Forme time to time, when attempting to save a webpage in IE6, I see the error: ------------------------------------ Error saving web page The web page cannot be saved to the selectged location ------------------------------------ It would not save on any other location. What is the reason for this error? Is this a code (server side or client side) to prevent a page from being
1
3791
by: Daniel | last post by:
after opening socket, sending data then closing socket 3000 times i get "Only one usage of each socket address" what am i doing wrong? is there some thing else i need to do to free up the socket after i send data into it? I simply want to open socket, send data, close socket and have the server just handle one client thread to recieve connection, recieve data, and close socket
4
3576
by: David | last post by:
I'm wondering if python is capable of fairly precise timing and also sending data out the parallel port. For example ; making a 7.5 KHz square wave come out of one of the data pins on the printer port. I've tried to help myself with this one but searching in the "Python Library Reference" that installed with my version, yielded nothing on the subject of either timing or parallel port.
4
8198
by: yaron | last post by:
Hi, I have a problem when sending data over TCP socket from c# client to java server. the connection established ok, but i can't send data from c# client to java server. it's work ok with TcpClient, NetworkStream and StreamWriter classes. but with low level socket it doesn't work (When using the Socket class Send method).
2
2468
by: Carpe Diem | last post by:
Hello all. My host is experiencing some troubles and I think you'll answer me before they can. After I uploaded a slightly changed JScript.NET .aspx page (the contents are not important, could be just Response.End(); or anything) the page won't load but instead shows this: Server Error in '/' Application. Compilation Error
0
1791
by: vladimir.plotnikov | last post by:
Hello! I have problem: I have IPB forum installed. After search in IPB (search takes about 3-4 seconds for post table about 300 000 records) mysql shows "Sending Data" status and takes about 3-5 minutes. I tested with PHP 5.2, PHP 4.4, PHP 4.2.3 - with same results. I switched from MySQL 4.2.18 to 4.2.21 and 4.2.22 with same result.
1
1668
by: Charlie | last post by:
Hi: I need a way to test my TcpListner, but not sure what applications are sending data to tcp ports. How about Email or Instant Messenger? If they are tcp, what ports are they sending data to? Any other suggestions? Also, what port do Http responses target on client machine before being rendered in browser? Thanks,
5
1822
by: Navin Mishra | last post by:
Hi, In load test of our .NET 2.0 socket application on Win2003 server, we are seeing sometimes WSEWOULDBLOCK error when sending data to clients. We are using synchronoous scokets with SendTimout of 2 secs. Is it normal ? Thanks in advance and regards Navin
3
6632
by: Mateo | last post by:
(As.Net 1.1 framework!) Hi! So, I have problem as described in subject. Here is source code:
0
8676
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8608
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9029
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8867
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6522
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4370
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4619
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3050
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2006
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.